Re: [PATCH v6 0/4] commit: Add commit.verbose configuration
On Tue, Jun 17, 2014 at 14:38:56 -0500, Caleb Thompson wrote: This patch allows people to set commit.verbose to implicitly send --verbose to git-commit. It introduces several cleanup patches to t/t7505-commit-verbose.sh to bring it closer to the current state of the tests as they have been explained to me, then adds the verbose config and --no-verbose flag. Since the last version of this patch (http://thread.gmane.org/gmane.comp.version-control.git/251486), there have been a couple of commit message clarifications and the body of the check-for-no-diff script in the last patch was changed to simply negate check-for-diff. Hi Caleb, Do you intend to work further on this topic? I have been using a similar (but less polished) patch, and would like to see this included in Git. If you don't have time to work on it, I can incorporate the comments on this version and submit a v7. Torstein -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] branch: fix --verbose output column alignment
Commit f2e0873 (branch: report invalid tracking branch as gone) removed an early return from fill_tracking_info() in the path taken when 'git branch -v' lists a branch in sync with its upstream. This resulted in an unconditionally added space in front of the subject line: $ git branch -v * master f5eb3da commit pushed to upstream topic f935eb6 unpublished topic Instead, only add the trailing space if a decoration have been added. To catch this kind of whitespace breakage in the tests, be a bit less smart when filtering the output through sed. Signed-off-by: Torstein Hegge he...@resisty.net --- builtin/branch.c | 8 +++- t/t6040-tracking-info.sh | 24 +--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/builtin/branch.c b/builtin/branch.c index 0bb0e93..636a16e 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -424,6 +424,7 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name, struct branch *branch = branch_get(branch_name); struct strbuf fancy = STRBUF_INIT; int upstream_is_gone = 0; + int added_decoration = 1; switch (stat_tracking_info(branch, ours, theirs)) { case 0: @@ -451,9 +452,13 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name, if (upstream_is_gone) { if (show_upstream_ref) strbuf_addf(stat, _([%s: gone]), fancy.buf); + else + added_decoration = 0; } else if (!ours !theirs) { if (show_upstream_ref) strbuf_addf(stat, _([%s]), fancy.buf); + else + added_decoration = 0; } else if (!ours) { if (show_upstream_ref) strbuf_addf(stat, _([%s: behind %d]), fancy.buf, theirs); @@ -474,7 +479,8 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name, ours, theirs); } strbuf_release(fancy); - strbuf_addch(stat, ' '); + if (added_decoration) + strbuf_addch(stat, ' '); free(ref); } diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh index ba26cfe..7ac8fd0 100755 --- a/t/t6040-tracking-info.sh +++ b/t/t6040-tracking-info.sh @@ -39,12 +39,14 @@ test_expect_success setup ' advance h ' -script='s/^..\(b.\)[0-9a-f]*\[\([^]]*\)\].*/\1 \2/p' +script='s/^..\(b.\) *[0-9a-f]* \(.*\)$/\1 \2/p' cat expect \EOF -b1 ahead 1, behind 1 -b2 ahead 1, behind 1 -b3 behind 1 -b4 ahead 2 +b1 [ahead 1, behind 1] d +b2 [ahead 1, behind 1] d +b3 [behind 1] b +b4 [ahead 2] f +b5 g +b6 c EOF test_expect_success 'branch -v' ' @@ -57,12 +59,12 @@ test_expect_success 'branch -v' ' ' cat expect \EOF -b1 origin/master: ahead 1, behind 1 -b2 origin/master: ahead 1, behind 1 -b3 origin/master: behind 1 -b4 origin/master: ahead 2 -b5 brokenbase: gone -b6 origin/master +b1 [origin/master: ahead 1, behind 1] d +b2 [origin/master: ahead 1, behind 1] d +b3 [origin/master: behind 1] b +b4 [origin/master: ahead 2] f +b5 [brokenbase: gone] g +b6 [origin/master] c EOF test_expect_success 'branch -vv' ' -- 1.8.5.rc0.216.ge00de29 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: What's cooking in git.git (Nov 2013, #01; Fri, 1)
On Fri, Nov 01, 2013 at 15:52:06 -0700, Junio C Hamano wrote: * th/reflog-annotated-tag (2013-10-28) 1 commit (merged to 'next' on 2013-11-01 at 8b154cc) + reflog: handle lightweight and annotated tags equally git log -g $annotated_tag, when there is no reflog history, should have produced a single output entry (i.e. the ref creation event), but instead showed the history leading to the tag. This isn't really what th/reflog-annotated-tag does, git log -g $annotated_tag now produces no output. Is the proper behavior to output the ref creation event? In that case, should the same happen for lightweight tags? Or am I missing something related to when there is no reflog history? Torstein -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] reflog: handle lightweight and annotated tags equally
When 'git reflog tag' is called on a lightweight tag, nothing is output. However, when called on an annotated tag, shortened SHA-1s for all reachable commits are written on a single line. Teach add_pending_object_with_mode() to handle OBJ_TAG, so that 'git reflog' on an annotated tag is quiet, like it is for lightweight tags, commits and blobs. Signed-off-by: Torstein Hegge he...@resisty.net --- Try 'GIT_PAGER=cat git reflog v1.8.4' on git.git to see an example of this rather unexpected behavior. revision.c | 2 +- t/t1411-reflog-show.sh | 28 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/revision.c b/revision.c index 0173e01..fa4e660 100644 --- a/revision.c +++ b/revision.c @@ -198,7 +198,7 @@ static void add_pending_object_with_mode(struct rev_info *revs, return; if (revs-no_walk (obj-flags UNINTERESTING)) revs-no_walk = 0; - if (revs-reflog_info obj-type == OBJ_COMMIT) { + if (revs-reflog_info) { struct strbuf buf = STRBUF_INIT; int len = interpret_branch_name(name, 0, buf); int st; diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh index 6f47c0d..de9fb8d 100755 --- a/t/t1411-reflog-show.sh +++ b/t/t1411-reflog-show.sh @@ -166,4 +166,32 @@ test_expect_success 'git log -g -p shows diffs vs. parents' ' test_cmp expect actual ' +test_expect_success 'add annotated tag' ' + git tag -a -m tag message annotated-tag +' + +: expect +test_expect_success 'reflog on a tag' ' + git reflog two actual + test_cmp expect actual +' + +: expect +test_expect_success 'reflog on an annotated tag' ' + git reflog annotated-tag actual + test_cmp expect actual +' + +: expect +test_expect_success 'log -g on a tag' ' + git log -g two actual + test_cmp expect actual +' + +: expect +test_expect_success 'log -g on an annotated tag' ' + git log -g annotated-tag actual + test_cmp expect actual +' + test_done -- 1.8.4.1.808.g053d237 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] test-lib: fix typo in comment
Point test writers to the test_expect_* functions properly. Signed-off-by: Torstein Hegge he...@resisty.net --- t/test-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index 0fa7dfd..3dc1792 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -325,7 +325,7 @@ trap 'die' EXIT . $TEST_DIRECTORY/test-lib-functions.sh # You are not expected to call test_ok_ and test_failure_ directly, use -# the text_expect_* functions instead. +# the test_expect_* functions instead. test_ok_ () { test_success=$(($test_success + 1)) -- 1.8.4.1.808.g053d237 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Documentation/rev-list-options: add missing word in --*-parents
A commit has parent commits or parents, not commits. Signed-off-by: Torstein Hegge he...@resisty.net --- Documentation/rev-list-options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt index 27f8de3..5bdfb42 100644 --- a/Documentation/rev-list-options.txt +++ b/Documentation/rev-list-options.txt @@ -119,7 +119,7 @@ if it is part of the log message. --no-min-parents:: --no-max-parents:: - Show only commits which have at least (or at most) that many + Show only commits which have at least (or at most) that many parent commits. In particular, `--max-parents=1` is the same as `--no-merges`, `--min-parents=2` is the same as `--merges`. `--max-parents=0` gives all root commits and `--min-parents=3` all octopus merges. -- 1.8.4.rc1.372.g12d6635 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] bisect: Fix log output for multi-parent skip ranges
On Mon, Apr 22, 2013 at 23:02:29 +0200, Torstein Hegge wrote: There has to be a better way to get the range of possible first bad commits, similar to the output of 'git log --bisect --format=%H'. I just realized that this felt clunky because I didn't understand what '--not' does in git rev-list. In the case where the range of skipped commits include a merge and points in each parent marked good, I want git rev-list bad --not good-1 good-2 or git rev-list bad ^good-1 ^good-2 but instead I did git rev-list bad --not good-1 --not good-2 which will include commits outside the range of skipped commits. Sorry about that :/ --- 8 --- Subject: [PATCH] bisect: Fix log output for multi-parent skip ranges The bisect log output of skipped commits introduced in f989cac bisect: Log possibly bad, skipped commits at bisection end should obtain the range of skipped commits from git rev-list bad --not good-1 good-2 not git rev-list bad --not good-1 --not good-2 when the skipped range contains a merge with good points in each parent. Signed-off-by: Torstein Hegge he...@resisty.net --- git-bisect.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-bisect.sh b/git-bisect.sh index d7518e9..9f064b6 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -320,8 +320,8 @@ bisect_next() { elif test $res -eq 2 then echo # only skipped commits left to test $GIT_DIR/BISECT_LOG - good_revs=$(git for-each-ref --format=--not %(objectname) refs/bisect/good-*) - for skipped in $(git rev-list refs/bisect/bad $good_revs) + good_revs=$(git for-each-ref --format=%(objectname) refs/bisect/good-*) + for skipped in $(git rev-list refs/bisect/bad --not $good_revs) do skipped_commit=$(git show-branch $skipped) echo # possible first bad commit: $skipped_commit $GIT_DIR/BISECT_LOG -- 1.8.3.rc1.377.g7010c6b -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] bisect: Store first bad commit as comment in log file
On Mon, Apr 15, 2013 at 11:53:39 +0200, Torstein Hegge wrote: On Mon, Apr 15, 2013 at 06:38:09 +0200, Christian Couder wrote: I wonder if we should also write something into the bisect log if for example the bisection stopped because there are only 'skip'ped commits left to test. But maybe this could go into another patch after this one. Yes, that would be useful, but I wasn't able to determine all the cases that would be relevant to log. Only skipped commits left to test is one, but bisect--helper also exits on various problems related to merge base handling. The handling of problems related to inconsistent user input is probably not relevant to log. I took another look at this. I wasn't able to come up with anything useful for the The merge base $rev is bad case, but for the only skipped commits left to test case one could do something like this. There has to be a better way to get the range of possible first bad commits, similar to the output of 'git log --bisect --format=%H'. --- 8 --- Subject: [PATCH] bisect: Log possibly bad, skipped commits at bisection end If the bisection completes with only skipped commits left to as possible first bad commit, output the list of possible first bad commits to human readers of the bisection log. Signed-off-by: Torstein Hegge he...@resisty.net --- git-bisect.sh | 10 ++ t/t6030-bisect-porcelain.sh | 20 2 files changed, 30 insertions(+) diff --git a/git-bisect.sh b/git-bisect.sh index c58eea7..d7518e9 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -317,6 +317,16 @@ bisect_next() { bad_commit=$(git show-branch $bad_rev) echo # first bad commit: $bad_commit $GIT_DIR/BISECT_LOG exit 0 + elif test $res -eq 2 + then + echo # only skipped commits left to test $GIT_DIR/BISECT_LOG + good_revs=$(git for-each-ref --format=--not %(objectname) refs/bisect/good-*) + for skipped in $(git rev-list refs/bisect/bad $good_revs) + do + skipped_commit=$(git show-branch $skipped) + echo # possible first bad commit: $skipped_commit $GIT_DIR/BISECT_LOG + done + exit $res fi # Check for an error in the bisection process diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 4d3074a..064f5ce 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -759,4 +759,24 @@ test_expect_success 'bisect log: successfull result' ' git bisect reset ' +cat expected.bisect-skip-log EOF +# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add 4: Ciao for now into hello. +# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add 2: A new day for git into hello. +git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f' +# skip: [3de952f2416b6084f557ec417709eac740c6818c] Add 3: Another new day for git into hello. +git bisect skip 3de952f2416b6084f557ec417709eac740c6818c +# only skipped commits left to test +# possible first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add 4: Ciao for now into hello. +# possible first bad commit: [3de952f2416b6084f557ec417709eac740c6818c] Add 3: Another new day for git into hello. +EOF + +test_expect_success 'bisect log: only skip commits left' ' + git bisect reset + git bisect start $HASH4 $HASH2 + test_must_fail git bisect skip + git bisect log bisect-skip-log.txt + test_cmp expected.bisect-skip-log bisect-skip-log.txt + git bisect reset +' + test_done -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] bisect: Store first bad commit as comment in log file
On Mon, Apr 22, 2013 at 14:13:00 -0700, Junio C Hamano wrote: Torstein Hegge he...@resisty.net writes: I took another look at this. I wasn't able to come up with anything useful for the The merge base $rev is bad case, but for the only skipped commits left to test case one could do something like this. We skipped them because we can gain _no_ information from testing these commits. They are not even possibly bad, but are unknown. So it feels to me that by definition listing them would not be useful. What am I missing? The information lies in that those commits are the only commits with an unknown state. So if the bisecter hands off the bisect log to someone else when they can't test further, the current status is recorded. I think part of the reason I started looking at this is that there are no good way to see what git said after the previous 'git bisect good/bad' if the terminal output is lost. And lost terminal output is fairly likely if you are bisecting something that requires reboots for each test. But I don't feel very strongly about this. It was based on Christian's idea, so unless he comes up with some compelling arguments I'll drop it. -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] bisect: Store first bad commit as comment in log file
On Mon, Apr 15, 2013 at 06:38:09 +0200, Christian Couder wrote: I wonder if we should also write something into the bisect log if for example the bisection stopped because there are only 'skip'ped commits left to test. But maybe this could go into another patch after this one. Yes, that would be useful, but I wasn't able to determine all the cases that would be relevant to log. Only skipped commits left to test is one, but bisect--helper also exits on various problems related to merge base handling. The handling of problems related to inconsistent user input is probably not relevant to log. I think the successful bisect case is most important to log and the one that requires the least amount of invasive changes. diff --git a/git-bisect.sh b/git-bisect.sh index 99efbe8..c58eea7 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -311,7 +311,13 @@ bisect_next() { res=$? # Check if we should exit because bisection is finished - test $res -eq 10 exit 0 + if test $res -eq 10 + then + bad_rev=$(git show-ref --hash --verify refs/bisect/bad) I had a look to make sure that refs/bisect/bad always refered to the first bad commit at this point, and it is true indeed. According to Documentation/git-bisect.txt, refs/bisect/bad is the proper way to determine the first bad commit at the end of a bisection. Maybe you could have used git rev-parse --verify instead of git show-ref --hash --verify. It looks simpler to me. I was wondering why git grep show-ref *.sh gave so few users. It looks like rev-parse is more common. And maybe, just in case, you could have added: || die $(gettext Bad rev: refs/bisect/bad) Yes, I should probably have done that. Otherwise this patch looks good to me. Thanks. Torstein -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] bisect: Store first bad commit as comment in log file
When bisect successfully finds a single revision, the first bad commit should be shown to human readers of 'git bisect log'. This resolves the apparent disconnect between the bisection result and the log when a bug reporter says I know that the first bad commit is $rev, as you can see from $(git bisect log). Signed-off-by: Torstein Hegge he...@resisty.net --- I don't know how useful the added test is, I didn't find any existing tests that looks at the comment parts of bisect log. git-bisect.sh |8 +++- t/t6030-bisect-porcelain.sh | 18 ++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/git-bisect.sh b/git-bisect.sh index 99efbe8..c58eea7 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -311,7 +311,13 @@ bisect_next() { res=$? # Check if we should exit because bisection is finished - test $res -eq 10 exit 0 + if test $res -eq 10 + then + bad_rev=$(git show-ref --hash --verify refs/bisect/bad) + bad_commit=$(git show-branch $bad_rev) + echo # first bad commit: $bad_commit $GIT_DIR/BISECT_LOG + exit 0 + fi # Check for an error in the bisection process test $res -ne 0 exit $res diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 2fce99a..6e65cdf 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -741,4 +741,22 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' git bisect reset +cat expected.bisect-log EOF +# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add 4: Ciao for now into hello. +# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add 2: A new day for git into hello. +git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f' +# good: [3de952f2416b6084f557ec417709eac740c6818c] Add 3: Another new day for git into hello. +git bisect good 3de952f2416b6084f557ec417709eac740c6818c +# first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add 4: Ciao for now into hello. +EOF + +test_expect_success 'bisect log: successfull result' ' + git bisect reset + git bisect start $HASH4 $HASH2 + git bisect good + git bisect log bisect-log.txt + test_cmp expected.bisect-log bisect-log.txt + git bisect reset +' + test_done -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] t9903: Don't fail when run from path accessed through symlink
When the git directory is accessed through a symlink like ln -s /tmp/git /tmp/git-symlink cd /tmp/git-symlink/t make -C .. ./t9903-bash-prompt.sh $TRASH_DIRECTORY is /tmp/git-symlink/t/trash directory.t9903-bash-prompt and $(pwd -P) is /tmp/git/t/trash directory.t9903-bash-prompt. When __gitdir looks up the path through 'git rev-parse --git-dir', it will return paths similar to $(pwd -P). This behavior is already tested in t9903 'gitdir - resulting path avoids symlinks'. Signed-off-by: Torstein Hegge he...@resisty.net --- t/t9903-bash-prompt.sh | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index 2101d91..e147a8d 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -59,7 +59,7 @@ test_expect_success 'gitdir - .git directory in cwd' ' ' test_expect_success 'gitdir - .git directory in parent' ' - echo $TRASH_DIRECTORY/.git expected + echo $(pwd -P)/.git expected ( cd subdir/subsubdir __gitdir $actual @@ -77,7 +77,7 @@ test_expect_success 'gitdir - cwd is a .git directory' ' ' test_expect_success 'gitdir - parent is a .git directory' ' - echo $TRASH_DIRECTORY/.git expected + echo $(pwd -P)/.git expected ( cd .git/refs/heads __gitdir $actual @@ -115,7 +115,7 @@ test_expect_success 'gitdir - non-existing $GIT_DIR' ' ' test_expect_success 'gitdir - gitfile in cwd' ' - echo $TRASH_DIRECTORY/otherrepo/.git expected + echo $(pwd -P)/otherrepo/.git expected echo gitdir: $TRASH_DIRECTORY/otherrepo/.git subdir/.git test_when_finished rm -f subdir/.git ( @@ -126,7 +126,7 @@ test_expect_success 'gitdir - gitfile in cwd' ' ' test_expect_success 'gitdir - gitfile in parent' ' - echo $TRASH_DIRECTORY/otherrepo/.git expected + echo $(pwd -P)/otherrepo/.git expected echo gitdir: $TRASH_DIRECTORY/otherrepo/.git subdir/.git test_when_finished rm -f subdir/.git ( @@ -137,7 +137,7 @@ test_expect_success 'gitdir - gitfile in parent' ' ' test_expect_success SYMLINKS 'gitdir - resulting path avoids symlinks' ' - echo $TRASH_DIRECTORY/otherrepo/.git expected + echo $(pwd -P)/otherrepo/.git expected mkdir otherrepo/dir test_when_finished rm -rf otherrepo/dir ln -s otherrepo/dir link -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html