Re: [Bug report] git diff stat shows unrelated diff

2019-02-17 Thread Viresh Kumar
On 15-02-19, 08:09, Elijah Newren wrote: > Hi Viresh, > > On Thu, Feb 14, 2019 at 10:40 PM Viresh Kumar wrote: > > > > On 14-02-19, 13:23, Elijah Newren wrote: > > > I think you're getting tripped up by double-dot vs triple-dot with > > > diff being different than log: > > > > > > `git diff D..E`

Re: [Bug report] git diff stat shows unrelated diff

2019-02-17 Thread Junio C Hamano
Philip Oakley writes: > It was my understanding that the end point would be total removal of > any options and the typing of the double dot would be an error. Given > that hard end point I was looking to ensure that users of double dots > have a manageable route to unlearning old bad habits. Thus

Re: [Bug report] git diff stat shows unrelated diff

2019-02-17 Thread Philip Oakley
Hi Junio, On 17/02/2019 03:34, Junio C Hamano wrote: Philip Oakley writes: Those who do *not* opt into that "early warning" configuration dance would eventually be warned whenever they type "diff A..B", and the timing for that eventuality is not under their control, so quite honestly, I do no

Reverting merge commit

2019-02-17 Thread Roman Gelfand
Consider the following... 1. Release Branch 2. Each of the 3 developers are working on their own features. Each feature is a branch. Only one developer is working on each feature. 3. When a feature changes have been made, the feature branch is merged into the release branch. 4. After the merge i

RE: [Fix v1] builtin/ls-files.c: add error check on lstat for modified files

2019-02-17 Thread Randall S. Becker
On February 17, 2019 12:05, Ramsay Jones wrote: > On 17/02/2019 16:34, randall.s.bec...@rogers.com wrote: > > From: "Randall S. Becker" > > > > The result from lstat, checking whether a file has been deleted, is > > now included priot to calling id_modified when showing modified files. > > Prior >

Re: [Fix v1] builtin/ls-files.c: add error check on lstat for modified files

2019-02-17 Thread Ramsay Jones
On 17/02/2019 16:34, randall.s.bec...@rogers.com wrote: > From: "Randall S. Becker" > > The result from lstat, checking whether a file has been deleted, is now > included priot to calling id_modified when showing modified files. Prior s/priot/prior/; s/id_modified/ie_modified/ > to this fix,

[Fix v1] builtin/ls-files.c: add error check on lstat for modified files

2019-02-17 Thread randall . s . becker
From: "Randall S. Becker" The result from lstat, checking whether a file has been deleted, is now included priot to calling id_modified when showing modified files. Prior to this fix, it is possible that files that were deleted could show up as being modified because the lstat error was unchecked

RE: [BUG] ls-files showing deleted files (unchecked lstat return value)

2019-02-17 Thread Randall S. Becker
On February 17, 2019 8:50, Joe Ranieri wrote: > "git ls-files -m" can show deleted files, despite -d not having been > specified. > This is due to ls-files.c's show_files function calling lstat but not > checking the > return value before calling ie_modified with the uninitialized stat structure.

[BUG] ls-files showing deleted files (unchecked lstat return value)

2019-02-17 Thread Joe Ranieri
"git ls-files -m" can show deleted files, despite -d not having been specified. This is due to ls-files.c's show_files function calling lstat but not checking the return value before calling ie_modified with the uninitialized stat structure. This problem was found using the static analysis too

Re: [PATCH v3 03/21] diff-parseopt: convert --dirstat and friends

2019-02-17 Thread Andrei Rybak
On 2/16/19 12:36 PM, Nguyễn Thái Ngọc Duy wrote: > Signed-off-by: Nguyễn Thái Ngọc Duy > Signed-off-by: Junio C Hamano > --- > Documentation/diff-options.txt | 7 ++ > diff.c | 39 +- > 2 files changed, 36 insertions(+), 10 deletions(-

[PATCH 28/31] submodule-config.c: use repo_get_oid for reading .gitmodules

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Since 76e9bdc437 (submodule: support reading .gitmodules when it's not in the working tree - 2018-10-25), every time you do git grep --recurse-submodules you are likely to see one warning line per submodule (unless all those submodules also have submodules). On a superproject with plenty of s

[PATCH 26/31] sha1-name.c: remove the_repo from get_oid_with_context_1()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sha1-name.c b/sha1-name.c index 6b53ea2eeb..64a50d1291 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -12,6 +12,7 @@ #include "packfile.h" #include "object-store.h"

[PATCH 29/31] sha1-name.c: remove the_repo from maybe_die_on_misspelt_object_name

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 4 +++- setup.c | 7 --- sha1-name.c | 6 -- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cache.h b/cache.h index 942d9912a2..da7035c261 100644 --- a/cache.h +++ b/cache.h @@ -1361,7 +1361,9 @@ extern int get_oid

[PATCH 27/31] sha1-name.c: add repo_get_oid()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 3 ++- sha1-name.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 9ff5af0bef..942d9912a2 100644 --- a/cache.h +++ b/cache.h @@ -1354,7 +1354,8 @@ enum get_oid_result { */

[PATCH 30/31] sha1-name.c: remove the_repo from other get_oid_*

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 18 -- sha1-name.c | 35 --- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/cache.h b/cache.h index da7035c261..7ce8c566fc 100644 --- a/cache.h +++ b/cache.h @@ -1355,12 +1355,1

[PATCH 31/31] sha1-name.c: remove the_repo from get_oid_mb()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 3 ++- sha1-name.c | 18 +++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index 7ce8c566fc..24fbff94f7 100644 --- a/cache.h +++ b/cache.h @@ -1360,6 +1360,7 @@ int repo_get_oid_committish(st

[PATCH 22/31] sha1-name.c: remove the_repo from get_oid_1()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
There is a cyclic dependency between one of these functions so they cannot be converted one by one, so all related functions are converted at once. Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 7 +-- sha1-name.c | 59 - 2 files ch

[PATCH 15/31] sha1-name.c: remove the_repo from get_short_oid()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index cdcf84b826..2643b75b54 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -436,7 +436,8 @@ static void sort_ambiguous_oid_array(str

[PATCH 24/31] sha1-name.c: remove the_repo from diagnose_invalid_index_path()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- dir.c | 8 dir.h | 4 +++- sha1-name.c | 7 --- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dir.c b/dir.c index b2cabadf25..e6d97343f4 100644 --- a/dir.c +++ b/dir.c @@ -2315,6 +2315,14 @@ int file_exists(const c

[PATCH 23/31] sha1-name.c: remove the_repo from handle_one_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 5741a9f821..d9050776dd 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1189,15 +1189,21 @@ static enum get_oid_result get_oid

[PATCH 25/31] sha1-name.c: remove the_repo from resolve_relative_path()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
"remove" is not entirely correct. But at least the function is aware that if the given repo is not the_repository, then $CWD and is_inside_work_tree() means nothing. Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sh

[PATCH 06/31] refs.c: add repo_dwim_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 12 +--- refs.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/refs.c b/refs.c index 1f5864aa36..bd0fec5776 100644 --- a/refs.c +++ b/refs.c @@ -555,14 +555,20 @@ static char *substitute_branch_name(struct repositor

[PATCH 09/31] commit.c: add repo_get_commit_tree()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- commit.c | 5 +++-- commit.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/commit.c b/commit.c index a5333c7ac6..f0a5506f04 100644 --- a/commit.c +++ b/commit.c @@ -340,7 +340,8 @@ void free_commit_buffer(struct parsed_object_pool

[PATCH 08/31] refs.c: remove the_repo from read_ref_at()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/show-branch.c | 6 -- refs.c| 7 --- refs.h| 3 ++- sha1-name.c | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 934e514944

[PATCH 19/31] sha1-name.c: remove the_repo from get_oid_oneline()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 49c62d5254..fb80306f1a 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -15,7 +15,7 @@ #include "midx.h" #include "commit-reach.h"

[PATCH 21/31] sha1-name.c: remove the_repo from get_oid_basic()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 25 - 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 1cda854f02..d4c135aea8 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -773,8 +773,8 @@ static inline int push_mark(con

[PATCH 20/31] sha1-name.c: remove the_repo from get_describe_name()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index fb80306f1a..1cda854f02 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1097,7 +1097,9 @@ static int peel_onion(const char *name, int len,

[PATCH 18/31] sha1-name.c: add repo_interpret_branch_name()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 7d9512ac44..49c62d5254 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1390,7 +1390,8 @@ static int interpret_empty_at(const cha

[PATCH 01/31] packfile.c: add repo_approximate_object_count()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- packfile.c | 14 +++--- packfile.h | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packfile.c b/packfile.c index 16bcb75262..2ad4fab2f8 100644 --- a/packfile.c +++ b/packfile.c @@ -893,25 +893,25 @@ static void prepare_packe

[PATCH 02/31] refs.c: add refs_ref_exists()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 142888a40a..b869f32d8b 100644 --- a/refs.c +++ b/refs.c @@ -241,9 +241,14 @@ int read_ref(const char *refname, struct object_id *oid) return read_

[PATCH 03/31] refs.c: add refs_shorten_unambiguous_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 11 +-- refs.h | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index b869f32d8b..3dde824aab 100644 --- a/refs.c +++ b/refs.c @@ -1169,7 +1169,8 @@ int update_ref(const char *msg, const char *refname,

[PATCH 05/31] refs.c: remove the_repo from expand_ref()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c| 10 ++ refs.h| 2 +- upload-pack.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 44df049796..1f5864aa36 100644 --- a/refs.c +++ b/refs.c @@ -558,12 +558,13 @@ static char *subs

[PATCH 13/31] sha1-name.c: store and use repo in struct disambiguate_state

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 95 + 1 file changed, 59 insertions(+), 36 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 9b57787b76..a75992eb54 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -17,13 +17,14 @@

[PATCH 16/31] sha1-name.c: remove the_repo from interpret_nth_prior_checkout()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 2643b75b54..af8bf5b351 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -771,7 +771,7 @@ static inline int push_mark(const char *

[PATCH 12/31] sha1-name.c: add repo_find_unique_abbrev_r()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 6 -- sha1-name.c | 15 +-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index aa52850d84..524a44110a 100644 --- a/cache.h +++ b/cache.h @@ -1019,8 +1019,10 @@ extern void check_repository_

[PATCH 17/31] sha1-name.c: remove the_repo from interpret_branch_mark()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index af8bf5b351..7d9512ac44 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1412,9 +1412,9 @@ static int reinterpret(const char *name, in

[PATCH 14/31] sha1-name.c: add repo_for_each_abbrev()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 3 ++- sha1-name.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cache.h b/cache.h index 524a44110a..92973e7ae0 100644 --- a/cache.h +++ b/cache.h @@ -1366,7 +1366,8 @@ extern enum get_oid_result get_oid_with_contex

[PATCH 04/31] refs.c: remove the_repo from substitute_branch_name()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- cache.h | 8 ++-- refs.c | 9 + sha1-name.c | 8 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cache.h b/cache.h index 27fe635f62..aa52850d84 100644 --- a/cache.h +++ b/cache.h @@ -1442,8 +1442,12 @@ extern in

[PATCH 07/31] refs.c: add repo_dwim_log()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- refs.c | 21 +++-- refs.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index bd0fec5776..edea001446 100644 --- a/refs.c +++ b/refs.c @@ -603,9 +603,11 @@ int expand_ref(struct repository *repo, cons

[PATCH 11/31] sha1-name.c: remove the_repo from find_abbrev_len_packed()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 7558ce51a3..b9381aaba6 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -514,6 +514,7 @@ struct min_abbrev_data { unsigned int init_le

[PATCH 00/31] Kill the_repository in sha1-name.c

2019-02-17 Thread Nguyễn Thái Ngọc Duy
This whole series is to fix a known issue from ao/submodule-wo-gitmodules-checked-out. Commit 76e9bdc437 (submodule: support reading .gitmodules when it's not in the working tree - 2018-10-25) makes "git grep --recurse-submodules" print warning: nested submodules ... not supported yet one lin

[PATCH 10/31] sha1-name.c: remove the_repo from sort_ambiguous()

2019-02-17 Thread Nguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy --- sha1-name.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sha1-name.c b/sha1-name.c index 15a1107998..7558ce51a3 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -383,10 +383,11 @@ static int collect_ambiguous(const struc

Re: [PATCH 1/1] Introduce "precious" file concept

2019-02-17 Thread Duy Nguyen
On Sun, Feb 17, 2019 at 2:36 AM Ævar Arnfjörð Bjarmason wrote: > > > On Sat, Feb 16 2019, Nguyễn Thái Ngọc Duy wrote: > > [Re-CC some people involved the last time around] > > > A new attribute "precious" is added to indicate that certain files > > have valuable content and should not be easily di