Skip to content

Commit

Permalink
script with rev-list instead of log
Browse files Browse the repository at this point in the history
Because log.decorate now shows decorations for --pretty=oneline,
we must explicitly turn it off when scripting. Otherwise,
users with log.decorate set will get cruft like:

  $ git stash
  Saved working directory and index state WIP on master:
    2c1f7f5 (HEAD, master) commit subject

Instead of adding --no-decorate to the log command line,
let's just use the rev-list plumbing interface instead,
which does the right thing.

git-submodule has a similar call. Since it just counts the
commit lines, nothing is broken, but let's switch it, too,
for the sake of consistency and cleanliness.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Apr 9, 2010
1 parent 635530a commit b0e621a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion git-stash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ create_stash () {
# state of the base commit
if b_commit=$(git rev-parse --verify HEAD)
then
head=$(git log --no-color --abbrev-commit --pretty=oneline -n 1 HEAD --)
head=$(git rev-list --oneline -n 1 HEAD --)
else
die "You do not have the initial commit yet"
fi
Expand Down
2 changes: 1 addition & 1 deletion git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ cmd_summary() {
range=$sha1_dst
fi
GIT_DIR="$name/.git" \
git log --pretty=oneline --first-parent $range | wc -l
git rev-list --first-parent $range -- | wc -l
)
total_commits=" ($(($total_commits + 0)))"
;;
Expand Down

0 comments on commit b0e621a

Please sign in to comment.