Skip to contentSkip to conversation

Fix potential command line overflow in hooks--update

PATCH Applied Andy Parkins 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Fix potential command line overflow in hooks--update

In a repository with a large number of refs, the following command line could easily overflow the command line size limitations

git-rev-list $newref $(git-rev-parse --not --all)

Fortunately, git-rev-list already has the means to cope with this situation with the --stdin switch

git-rev-parse --not --all | git-rev-list --stdin $newref

Which is exactly what this patch does.

---
 templates/hooks--update |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
templates/hooks--update +1 -1
index d4253cb..e8c536f 100644
@@ -148,7 +148,7 @@ case "$refname_type" in
 			# This shows all log entries that are not already covered by
 			# another ref - i.e. commits that are now accessible from this
 			# ref that were previously not accessible
-			git-rev-list --pretty $newref $(git-rev-parse --not --all)
+			git-rev-parse --not --all | git-rev-list --stdin --pretty $newref
 			echo $LOGEND
 		else
 			# oldrev is valid
Signature · 1 line
1.5.0.rc4.364.g85b1
#1 lore raw
Quoted 3 lines · Andy Parkins

In a repository with a large number of refs, the following command line could easily overflow the command line size limitations
...

Thanks, applied.