pull: handle --log=<n>
Since efb779f (merge, pull: add '--(no-)log' command line option, 2008-04-06) git-pull supported the (--no-)log switch and would pass it to git-merge. 96e9420 (merge: Make '--log' an integer option for number of shortlog entries, 2010-09-08) implemented support for the --log=<n> switch, which would explicitly set the number of shortlog entries. However, git-pull does not recognize this option, and will instead pass it to git-fetch, leading to "unknown option" errors. Fix this by matching --log=* in addition to --log and --no-log. Implement a test for this use case. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Paul Tan committed
May 18, 2015 at 21:39 UTC
5061a44bcc7bfab0764b3854b8b2df69a93675ad
2 files changed
+19
-2
git-pull.sh
+2
-2
@@ -81,8 +81,8 @@ do
81
diffstat=--no-stat ;;
82
--stat|--summary)
83
diffstat=--stat ;;
84
- --log|--no-log)
85
- log_arg=$1 ;;
84
+ --log|--log=*|--no-log)
85
+ log_arg="$1" ;;
86
--no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit)
87
no_commit=--no-commit ;;
88
--c|--co|--com|--comm|--commi|--commit)
t/t5524-pull-msg.sh
+17
@@ -17,6 +17,9 @@ test_expect_success setup '
17
git commit -m "add bfile"
18
) &&
19
test_tick && test_tick &&
20
+ echo "second" >afile &&
21
+ git add afile &&
22
+ git commit -m "second commit" &&
23
echo "original $dollar" >afile &&
24
git add afile &&
25
git commit -m "do not clobber $dollar signs"
@@ -32,4 +35,18 @@ test_expect_success pull '
35
)
36
'
37
38
+test_expect_success '--log=1 limits shortlog length' '
39
+(
40
+ cd cloned &&
41
+ git reset --hard HEAD^ &&
42
+ test "$(cat afile)" = original &&
43
+ test "$(cat bfile)" = added &&
44
+ git pull --log=1 &&
45
+ git log -3 &&
46
+ git cat-file commit HEAD >result &&
47
+ grep Dollar result &&
48
+ ! grep "second commit" result
49
+)
50
+'
51
+
52
test_done