* [PATCH] Show which files was changed in the git log output
@ 2005-04-25 1:22 Jonas Fonseca
0 siblings, 0 replies; only message in thread
From: Jonas Fonseca @ 2005-04-25 1:22 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
[-- Attachment #1: Type: text/plain, Size: 510 bytes --]
Hi,
I have attached a patch probe to optionally have the git log command
list which files was changed by a commit.
It would be nice if someone with a more in depth knowledge of which
sha1s to pass to diff-tree when there are multiple parents could comment
on whether it does the right thing.
Right now it does the following: if there are only one parent it is
diffed against the commit tree and if there are two parents they are
diffed. I assume the order they are diffed doesn't matter.
--
Jonas Fonseca
[-- Attachment #2: show-changed-files.patch --]
[-- Type: text/plain, Size: 2533 bytes --]
Index: githelp.sh
===================================================================
--- 7de71a831508e51e0985cea173f3f7a7012c82b7/githelp.sh (mode:100755 sha1:e19176d4ef69a2e7c6da6b9893e2c7cdac24760a)
+++ uncommitted/githelp.sh (mode:100755)
@@ -19,7 +19,7 @@
fork BNAME BRANCH_DIR [COMMIT_ID]
help
init RSYNC_URL
- log [-c] [COMMIT_ID | COMMIT_ID:COMMIT_ID]
+ log [-c] [-f] [COMMIT_ID | COMMIT_ID:COMMIT_ID]
ls [TREE_ID]
lsobj [OBJTYPE]
lsremote
Index: gitlog.sh
===================================================================
--- 7de71a831508e51e0985cea173f3f7a7012c82b7/gitlog.sh (mode:100755 sha1:a09ffda484bd859a3bcb1cffcc8fd6f9c65fa8e7)
+++ uncommitted/gitlog.sh (mode:100755)
@@ -13,8 +13,11 @@
# header Green
# author Cyan
# committer Magenta
+# files Blue
# signoff Yellow
#
+# Takes an -f option to show which files was changed.
+#
# Takes an id resolving to a commit to start from (HEAD by default),
# or id1:id2 representing an (id1;id2] range of commits to show.
@@ -24,16 +27,25 @@
colheader="$(tput setaf 2)" # Green
colauthor="$(tput setaf 6)" # Cyan
colcommitter="$(tput setaf 5)" # Magenta
+ colfiles="$(tput setaf 4)" # Blue
colsignoff="$(tput setaf 3)" # Yellow
coldefault="$(tput op)" # Restore default
else
colheader=
colauthor=
colcommitter=
+ colfiles=
colsignoff=
coldefault=
fi
+if [ "$1" = "-f" ]; then
+ shift
+ list_files=1
+else
+ list_files=
+fi
+
if echo "$1" | grep -q ':'; then
id1=$(commit-id $(echo "$1" | cut -d : -f 1)) || exit 1
id2=$(commit-id $(echo "$1" | cut -d : -f 2)) || exit 1
@@ -49,6 +61,8 @@
$revls | $revsort | while read time commit parents; do
[ "$revfmt" = "rev-list" ] && commit="$time"
+ tree1=
+ tree2=
echo $colheader""commit ${commit%:*} $coldefault;
cat-file commit $commit | \
while read key rest; do
@@ -73,11 +87,32 @@
fi
;;
"")
+ if [ -n $list_files ]; then
+ sep=
+ echo
+ echo -n " * $colfiles"
+ diff-tree -r $tree1 $tree2 | \
+ while read modes type sha1s file; do
+ echo -n "$sep$file"
+ sep=", "
+ done
+ echo "$coldefault"
+ fi
echo; sed -re '
/ *Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/
s/^/ /
'
;;
+ "tree"|"parent")
+ if [ -z $tree1 ]; then
+ tree1=$rest
+ elif [ -z $tree2 ]; then
+ tree2=$rest
+ else
+ tree1=$rest
+ fi
+ echo $colheader$key $rest $coldefault
+ ;;
*)
echo $colheader$key $rest $coldefault
;;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-25 1:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-25 1:22 [PATCH] Show which files was changed in the git log output Jonas Fonseca
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).