Git development
 help / color / mirror / Atom feed
* Re: [PATCH 4/4] git-difftool: use git-mergetool--lib for "--tool-help"
From: John Keeping @ 2013-01-25  9:19 UTC (permalink / raw)
  To: David Aguilar; +Cc: git
In-Reply-To: <CAJDDKr4ZpQr029FW0v8LzwvhXZYmvAONbbZNuOq_E=Q1UzufvA@mail.gmail.com>

On Thu, Jan 24, 2013 at 09:29:58PM -0800, David Aguilar wrote:
> On Thu, Jan 24, 2013 at 11:55 AM, John Keeping <john@keeping.me.uk> wrote:
> > The "--tool-help" option to git-difftool currently displays incorrect
> > output since it uses the names of the files in
> > "$GIT_EXEC_PATH/mergetools/" rather than the list of command names in
> > git-mergetool--lib.
> >
> > Fix this by simply delegating the "--tool-help" argument to the
> > show_tool_help function in git-mergetool--lib.
> 
> Very nice.
> 
> One thought I had was that the unified show_tool_help should
> probably check TOOL_MODE=diff and skip over the
> !can_diff entries.
> 
> The current output of "git difftool --tool-help" before your
> patches has the problem that it will list tools such as
> "tortoisemerge" as "valid but not available" because it
> does not differentiate between missing and !can_diff.

list_merge_tool_candidates does this for us, so it should Just Work
since we use that to generate the list of tools that we loop over.


John

^ permalink raw reply

* Re: [PATCH v4 1/4] t6006 (rev-list-format): don't hardcode SHA-1 in expected outputs
From: Alexey Shumkin @ 2013-01-25  9:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v38xqba04.fsf@alter.siamese.dyndns.org>

> Alexey Shumkin <alex.crezoff@gmail.com> writes:
> 
> > The expected SHA-1 digests are always available in variables.  Use
> > them instead of hardcoding.
> >
> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
> > ---
> >  t/t6006-rev-list-format.sh | 130
> > +++++++++++++++++++++++++-------------------- 1 file changed, 72
> > insertions(+), 58 deletions(-)
> >
> > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
> > index f94f0c4..c248509 100755
> > --- a/t/t6006-rev-list-format.sh
> > +++ b/t/t6006-rev-list-format.sh
> > @@ -6,8 +6,19 @@ test_description='git rev-list --pretty=format
> > test' 
> >  test_tick
> >  test_expect_success 'setup' '
> > -touch foo && git add foo && git commit -m "added foo" &&
> > -  echo changed >foo && git commit -a -m "changed foo"
> > +	touch foo &&
> 
> This is inherited from the original, but these days we try to avoid
> touch, unless it is about setting a new file timestamp.  The
> canonical (in the script we write) way to create an empty file is:
> 
>     : >foo
> 
> with or without ": ", it does not matter that much.
Ok!

> 
> > +	git add foo &&
> > +	git commit -m "added foo" &&
> > +	head1=$(git rev-parse --verify HEAD) &&
> > +	head1_7=$(echo $head1 | cut -c1-7) &&
> 
> Why do we want "whatever_7" variables and use "cut -c1-7" to produce
> them?  Is "7" something we care deeply about?
I did not spend too much time to think of names of variables at the
moment I was writing this code )
> 
> I think what we care a lot more than "7" that happens to be the
> current default value is to make sure that, if we ever update the
> default abbreviation length to a larger value, the abbreviation
> shown with --format=%h is consistent with the abbreviation that is
> given by rev-parse --short.
> 
>     head1_short=$(git rev-parse --short $head1)
> 
> perhaps?
It's an inherited code from 1.5 years ago Git ;) taken from some other
tests
I'll change it as you propose )

> 
> > +	echo changed >foo &&
> > +	git commit -a -m "changed foo" &&
> > +	head2=$(git rev-parse --verify HEAD) &&
> > +	head2_7=$(echo $head2 | cut -c1-7) &&
> > +	head2_parent=$(git cat-file -p HEAD | grep parent | cut -f
> > 2 -d" ") &&
> 
> Do not use "cat-file -p" that is for human consumption in scripts,
> unless you are testing how the format for human consumption should
> look like (we may later add more pretty-print to them), which is not
> the case here.
> 
> Also be careful and pay attention to the end of the header; you do
> not want to pick up a random "parent" string in the middle of a log
> message.
> 
>     head2_parent=$(git cat-file commit HEAD | sed -n -e
> "s/^parent //p" -e "/^$/q")
> 
> would be much better.
yep! you're definitely right

> 
> > +	head2_parent_7=$(echo $head2_parent | cut -c1-7) &&
> > +	tree2=$(git cat-file -p HEAD | grep tree | cut -f 2 -d" ")
> > &&
> 
> Likewise.
> 
> > +	tree2_7=$(echo $tree2 | cut -c1-7)
> 
> Likewise.
> 
> > @@ -131,39 +142,42 @@ This commit message is much longer than the
> > others, and it will be encoded in iso8859-1. We should therefore
> >  include an iso8859 character: ¡bueno!
> >  EOF
> > +
> >  test_expect_success 'setup complex body' '
> > -git config i18n.commitencoding iso8859-1 &&
> > -  echo change2 >foo && git commit -a -F commit-msg
> > +	git config i18n.commitencoding iso8859-1 &&
> > +	echo change2 >foo && git commit -a -F commit-msg &&
> > +	head3=$(git rev-parse --verify HEAD) &&
> > +	head3_7=$(echo $head3 | cut -c1-7)
> >  '
> 
> Likewise.
> 
> Thanks.

^ permalink raw reply

* Re: What's cooking in git.git (Jan 2013, #08; Tue, 22)
From: John Keeping @ 2013-01-25  9:09 UTC (permalink / raw)
  To: Chris Rorvick; +Cc: Junio C Hamano, git, Eric S. Raymond
In-Reply-To: <CAEUsAPagzN9wWAsSpBVOv7+ei3fAix407dB0EAUd7q7k7SugPw@mail.gmail.com>

On Thu, Jan 24, 2013 at 10:55:57PM -0600, Chris Rorvick wrote:
> On Wed, Jan 23, 2013 at 3:12 PM, John Keeping <john@keeping.me.uk> wrote:
> > The existing script (git-cvsimport.perl) won't ever work with cvsps-3
> > since features it relies on have been removed.
> 
> Not reporting the ancestry branch seems to be the big one.  Are there
> others?

For some reason I thought the non-fast-export output mode had already
been removed, but now that I check it looks like it's still there just
with a warning that it may be removed in the future.


John

^ permalink raw reply

* Re: [PATCH v4 2/4] t7102 (reset): refactoring: don't hardcode SHA-1 in expected outputs
From: Alexey Shumkin @ 2013-01-25  9:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vy5fi9vcz.fsf@alter.siamese.dyndns.org>

> Alexey Shumkin <alex.crezoff@gmail.com> writes:
> 
> > The expected SHA-1 digests are always available in variables.  Use
> > them instead of hardcoding.
> >
> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
> > ---
> 
> Looks good (" refactoring:" in the title may not want to be there,
> though).
oops, it's remained from "working version" after rebasing

> 
> Thanks.
> 
> >  t/t7102-reset.sh | 41 +++++++++++++++++++++--------------------
> >  1 file changed, 21 insertions(+), 20 deletions(-)
> >
> > diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
> > index b096dc8..cf492f4 100755
> > --- a/t/t7102-reset.sh
> > +++ b/t/t7102-reset.sh
> > @@ -28,7 +28,8 @@ test_expect_success 'creating initial files and
> > commits' ' 
> >  	echo "1st line 2nd file" >secondfile &&
> >  	echo "2nd line 2nd file" >>secondfile &&
> > -	git commit -a -m "modify 2nd file"
> > +	git commit -a -m "modify 2nd file" &&
> > +	head5=$(git rev-parse --verify HEAD)
> >  '
> >  # git log --pretty=oneline # to see those SHA1 involved
> >  
> > @@ -56,7 +57,7 @@ test_expect_success 'giving a non existing
> > revision should fail' ' test_must_fail git reset --mixed aaaaaa &&
> >  	test_must_fail git reset --soft aaaaaa &&
> >  	test_must_fail git reset --hard aaaaaa &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +	check_changes $head5
> >  '
> >  
> >  test_expect_success 'reset --soft with unmerged index should fail'
> > ' @@ -74,7 +75,7 @@ test_expect_success \
> >  	test_must_fail git reset --hard -- first &&
> >  	test_must_fail git reset --soft HEAD^ -- first &&
> >  	test_must_fail git reset --hard HEAD^ -- first &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +	check_changes $head5
> >  '
> >  
> >  test_expect_success 'giving unrecognized options should fail' '
> > @@ -86,7 +87,7 @@ test_expect_success 'giving unrecognized options
> > should fail' ' test_must_fail git reset --soft -o &&
> >  	test_must_fail git reset --hard --other &&
> >  	test_must_fail git reset --hard -o &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +	check_changes $head5
> >  '
> >  
> >  test_expect_success \
> > @@ -110,7 +111,7 @@ test_expect_success \
> >  
> >  	git checkout master &&
> >  	git branch -D branch1 branch2 &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +	check_changes $head5
> >  '
> >  
> >  test_expect_success \
> > @@ -133,27 +134,27 @@ test_expect_success \
> >  
> >  	git checkout master &&
> >  	git branch -D branch3 branch4 &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +	check_changes $head5
> >  '
> >  
> >  test_expect_success \
> >  	'resetting to HEAD with no changes should succeed and do
> > nothing' ' git reset --hard &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +		check_changes $head5 &&
> >  	git reset --hard HEAD &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +		check_changes $head5 &&
> >  	git reset --soft &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +		check_changes $head5 &&
> >  	git reset --soft HEAD &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +		check_changes $head5 &&
> >  	git reset --mixed &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +		check_changes $head5 &&
> >  	git reset --mixed HEAD &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +		check_changes $head5 &&
> >  	git reset &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +		check_changes $head5 &&
> >  	git reset HEAD &&
> > -		check_changes
> > 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +		check_changes $head5
> >  '
> >  
> >  >.diff_expect
> > @@ -176,7 +177,7 @@ test_expect_success '--soft reset only should
> > show changes in diff --cached' ' git reset --soft HEAD^ &&
> >  	check_changes d1a4bc3abce4829628ae2dcb0d60ef3d1a78b1c4 &&
> >  	test "$(git rev-parse ORIG_HEAD)" = \
> > -			3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +			$head5
> >  '
> >  
> >  >.diff_expect
> > @@ -193,7 +194,7 @@ test_expect_success \
> >  	git commit -a -C ORIG_HEAD &&
> >  	check_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&
> >  	test "$(git rev-parse ORIG_HEAD)" = \
> > -			3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +			$head5
> >  '
> >  
> >  >.diff_expect
> > @@ -303,7 +304,7 @@ test_expect_success 'redoing the last two
> > commits should succeed' ' echo "1st line 2nd file" >secondfile &&
> >  	echo "2nd line 2nd file" >>secondfile &&
> >  	git commit -a -m "modify 2nd file" &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +	check_changes $head5
> >  '
> >  
> >  >.diff_expect
> > @@ -341,15 +342,15 @@ EOF
> >  test_expect_success \
> >  	'--hard reset to ORIG_HEAD should clear a fast-forward
> > merge' ' git reset --hard HEAD^ &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +	check_changes $head5 &&
> >  
> >  	git pull . branch1 &&
> >  	git reset --hard ORIG_HEAD &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc &&
> > +	check_changes $head5 &&
> >  
> >  	git checkout master &&
> >  	git branch -D branch1 branch2 &&
> > -	check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc
> > +	check_changes $head5
> >  '
> >  
> >  cat > expect << EOF

^ permalink raw reply

* Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting
From: Alexey Shumkin @ 2013-01-25  9:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vr4la9uqo.fsf@alter.siamese.dyndns.org>

> Alexey Shumkin <alex.crezoff@gmail.com> writes:
> 
> > The following two commands are expected to give the same output to
> > a terminal:
> >
> > 	$ git log --oneline --no-color
> > 	$ git log --pretty=format:'%h %s'
> >
> > However, the former pays attention to i18n.logOutputEncoding
> > configuration, while the latter does not when it format "%s".
> > Log messages written in an encoding i18n.commitEncoding which
> > differs from terminal encoding are shown corrupted with the latter
> > even when i18n.logOutputEncoding and terminal encoding are the same.
> >
> > The same corruption is true for
> > 	$ git diff --submodule=log
> > and
> > 	$ git rev-list --pretty=format:%s HEAD
> > and
> > 	$ git reset --hard
> >
> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
> > ---
> >  t/t4041-diff-submodule-option.sh | 33 ++++++++-------
> >  t/t4205-log-pretty-formats.sh    | 43 +++++++++++++++----
> >  t/t6006-rev-list-format.sh       | 90
> > ++++++++++++++++++++++++++--------------
> > t/t7102-reset.sh                 | 32 +++++++++++--- 4 files
> > changed, 138 insertions(+), 60 deletions(-)
> >
> > diff --git a/t/t4041-diff-submodule-option.sh
> > b/t/t4041-diff-submodule-option.sh index 32d4a60..e7d6363 100755
> > --- a/t/t4041-diff-submodule-option.sh
> > +++ b/t/t4041-diff-submodule-option.sh
> > @@ -1,6 +1,7 @@
> >  #!/bin/sh
> >  #
> >  # Copyright (c) 2009 Jens Lehmann, based on t7401 by Ping Yin
> > +# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding
> > tests) #
> >  
> >  test_description='Support for verbose submodule differences in git
> > diff @@ -10,6 +11,7 @@ This test tries to verify the sanity of the
> > --submodule option of git diff. 
> >  . ./test-lib.sh
> >  
> > +added=$(printf
> > "\320\264\320\276\320\261\320\260\320\262\320\273\320\265\320\275")
> 
> Please have an in-code comment before this line to explain what this
> variable is about, e.g.
> 
> 	# String "added" in Russian, encoded in UTF-8, used in
>         # sample commit log messages in add_file() function below.
>         added=$(printf "...")
Ok!

> 
> >  add_file () {
> >  	(
> >  		cd "$1" &&
> > @@ -19,7 +21,8 @@ add_file () {
> >  			echo "$name" >"$name" &&
> >  			git add "$name" &&
> >  			test_tick &&
> > -			git commit -m "Add $name" || exit
> > +			msg_added_cp1251=$(echo "Add $name ($added
> > $name)" | iconv -f utf-8 -t cp1251) &&
> > +			git -c 'i18n.commitEncoding=cp1251' commit
> > -m "$msg_added_cp1251" done >/dev/null &&
> >  		git rev-parse --short --verify HEAD
> >  	)
> 
> Does this patch make the all tests in this script fail for people
> without cp1251 locale installed?  We already have tests that depend
> on 8859-1 and some other locales, and we'd be better off limiting
> such dependency to the minimum.
Hmmm, I'll try to feign something to avoid using cp1251

> 
> Same comment applies to the changes to other test scripts.
> 
> Thanks.

^ permalink raw reply

* [PATCH] mergetools: Enhance tortoisemerge to work with
From: Sven Strickroth @ 2013-01-25  9:06 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Sebastian Schuberth, davvid, Jeff King
In-Reply-To: <5101B0A5.1020308@tu-clausthal.de>

TortoiseGitMerge and filenames with spaces

- The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe
  (starting with 1.8.0) in order to make clear that this one has special
  support for git, (uses spaces as cli parameter key-value separators)
  and prevent confusion with the TortoiseSVN TortoiseMerge version.
- The tortoisemerge mergetool does not work with filenames which have
  a space in it. Fixing this required changes in git and also in
  TortoiseGitMerge; see https://github.com/msysgit/msysgit/issues/57.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Reported-by: Sebastian Schuberth <sschuberth@gmail.com>
---
 mergetools/tortoisemerge | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/mergetools/tortoisemerge b/mergetools/tortoisemerge
index ed7db49..9890737 100644
--- a/mergetools/tortoisemerge
+++ b/mergetools/tortoisemerge
@@ -6,12 +6,28 @@ merge_cmd () {
 	if $base_present
 	then
 		touch "$BACKUP"
-		"$merge_tool_path" \
-			-base:"$BASE" -mine:"$LOCAL" \
-			-theirs:"$REMOTE" -merged:"$MERGED"
+		if test "$merge_tool_path" == "tortoisegitmerge"
+		then
+			"$merge_tool_path" \
+				-base "$BASE" -mine "$LOCAL" \
+				-theirs "$REMOTE" -merged "$MERGED"
+		else 
+			"$merge_tool_path" \
+				-base:"$BASE" -mine:"$LOCAL" \
+				-theirs:"$REMOTE" -merged:"$MERGED"
+		fi
 		check_unchanged
 	else
-		echo "TortoiseMerge cannot be used without a base" 1>&2
+		echo "$merge_tool_path cannot be used without a base" 1>&2
 		return 1
 	fi
 }
+
+translate_merge_tool_path() {
+	if type tortoisegitmerge >/dev/null 2>/dev/null
+	then
+		echo tortoisegitmerge
+	else
+		echo tortoisemerge
+	fi
+}
-- 
Best regards,
 Sven Strickroth
 PGP key id F5A9D4C4 @ any key-server

^ permalink raw reply related

* Re: [PATCH v4 3/4] pretty: Add failing tests: user format ignores i18n.logOutputEncoding setting
From: Alexey Shumkin @ 2013-01-25  9:01 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vip6m9tvj.fsf@alter.siamese.dyndns.org>

> Alexey Shumkin <alex.crezoff@gmail.com> writes:
> 
> > diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
> > index c248509..4db43a4 100755
> > --- a/t/t6006-rev-list-format.sh
> > +++ b/t/t6006-rev-list-format.sh
> > ...
> > @@ -112,12 +133,12 @@ commit $head2
> >  commit $head1
> >  EOF
> >  
> > -test_format raw-body %B <<'EOF'
> > -commit 131a310eb913d107dd3c09a65d1651175898735d
> > -changed foo
> > +test_format failure raw-body %B <<EOF
> > +commit $head2
> > +$changed
> >  
> > -commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873
> > -added foo
> > +commit $head1
> > +$added
> >  
> >  EOF
> 
> It may have been easier to follow if you did this "Don't hardcode"
> as a separate preparatory patch, like your first two patches.
Yep, I missed that in my bunch of rebasing ;)

> 
> > @@ -135,16 +156,16 @@ commit $head1
> >  foo
> >  EOF
> >  
> > -cat >commit-msg <<'EOF'
> > +iconv -f utf-8 -t cp1251 > commit-msg <<EOF
> >  Test printing of complex bodies
> >  
> >  This commit message is much longer than the others,
> > -and it will be encoded in iso8859-1. We should therefore
> > -include an iso8859 character: ¡bueno!
> > +and it will be encoded in cp1251. We should therefore
> > +include an cp1251 character: так вот!
> >  EOF
> >  
> >  test_expect_success 'setup complex body' '
> > -	git config i18n.commitencoding iso8859-1 &&
> > +	git config i18n.commitencoding cp1251 &&
> 
> What is going on here?
> 
> Is this an example that shows that i18n.commitencoding works
> correctly with iso8859-1 but not with cp1251?
It show only that I speak and write Russian not Spanish ))
I'll revert back these changes.

> 
> > diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
> > index cf492f4..699c824 100755
> > --- a/t/t7102-reset.sh
> > +++ b/t/t7102-reset.sh
> > ...
> > @@ -192,7 +214,7 @@ test_expect_success \
> >  	'changing files and redo the last commit should succeed' '
> >  	echo "3rd line 2nd file" >>secondfile &&
> >  	git commit -a -C ORIG_HEAD &&
> > -	check_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d &&
> > +	check_changes f06f78b8dd468c722952b77569dd0db212442c25 &&
> >  	test "$(git rev-parse ORIG_HEAD)" = \
> >  			$head5
> >  '
> 
> This and remaining hunks to this script shows that it would be
> helped by the same love you gave to other scripts with your first
> two patches before you add the "non-unicode" tests, no?
Sorry, I haven't got you :-[ (it seems, my English is not good enough)
Do you mean "avoid hardcoded SHA-1"?

^ permalink raw reply

* Fwd: Separately repository access in GitWeb
From: Андрей Баранов @ 2013-01-25  9:00 UTC (permalink / raw)
  To: git
In-Reply-To: <CAJjU7bS-rRr-UuEA_xcqtTY4+tWKshL+Rvey85n70KacSnTorQ@mail.gmail.com>

good day.

I`m trying make separately repository access in GitWeb by NGINX

separation of access based on URL strings, namely, the presence of the
query strings:
'?p=repo.git'
with a regular expression:
"^.*p=(.*?)(\.git|;|&|=|\s).*$"

I am wondering how much it is correct to protect against unauthorized access.

Thanks in advance :)

complete example of a configuration file:

server {
        listen 80;

root /home/git/gitweb;

        access_log /var/log/nginx/gitweb.access_log main;
        error_log /var/log/nginx/gitweb.error_log info;

        index gitweb.cgi;
gzip off;

    location ~* \.(jpg|txt|jpeg|gif|png|ico|css|zip|js|swf)$ {
access_log        off;
        expires 1d;
    }

    location = / {
set $htpasswd "opened@";
if ($args ~* "^.*p=(.*?)(\.git|;|&|=|\s).*$") {
set $htpasswd /home/git/.gitolite/conf/$1_htpasswd;
        }
        if (-f $htpasswd) {
                rewrite ^.*$  /closed last;
        }

rewrite ^.*$ /guest last;
    }

    location = /closed {
internal;
access_log /var/log/nginx/gitweb-closed.access_log main;
auth_basic "Unauthorized";
        auth_basic_user_file $htpasswd;
        include fastcgi_params;
        fastcgi_param  SCRIPT_NAME gitweb.cgi;
        fastcgi_param SCRIPT_FILENAME /home/git/gitweb/gitweb.cgi;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }

    location = /guest {
internal;
access_log /var/log/nginx/gitweb-guest.access_log main;
        include fastcgi_params;
fastcgi_param  SCRIPT_NAME gitweb.cgi;
fastcgi_param SCRIPT_FILENAME /home/git/gitweb/gitweb.cgi;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }

    location  / {
        rewrite (.*) / permanent;
    }

}

^ permalink raw reply

* Re: [PATCH] branch: reject -D/-d without branch name
From: Duy Nguyen @ 2013-01-25  8:56 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git, Junio C Hamano
In-Reply-To: <vpqmwvxhcra.fsf@grenoble-inp.fr>

On Fri, Jan 25, 2013 at 3:45 PM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> diff --git a/builtin/branch.c b/builtin/branch.c
>> index 873f624..1d3e842 100644
>> --- a/builtin/branch.c
>> +++ b/builtin/branch.c
>> @@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>>               colopts = 0;
>>       }
>>
>> -     if (delete)
>> +     if (delete && argc)
>>               return delete_branches(argc, argv, delete > 1, kinds, quiet);
>>       else if (list) {
>>               int ret = print_ref_list(kinds, detached, verbose, abbrev,
>
> Shouldn't this error out with a clean error message ("branch name
> expected" or so)?

Yeah. But on the other hand, this command seems to prefer to print
help usage when incorrect number of arguments is given (checkout
blocks "if (edit_description)" and "if (rename)" in cmd_branch).
Should those be fixed too?
-- 
Duy

^ permalink raw reply

* Re: [PATCH] branch: reject -D/-d without branch name
From: Matthieu Moy @ 2013-01-25  8:45 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: git, Junio C Hamano
In-Reply-To: <1359102416-1240-1-git-send-email-pclouds@gmail.com>

Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:

> diff --git a/builtin/branch.c b/builtin/branch.c
> index 873f624..1d3e842 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
>  		colopts = 0;
>  	}
>  
> -	if (delete)
> +	if (delete && argc)
>  		return delete_branches(argc, argv, delete > 1, kinds, quiet);
>  	else if (list) {
>  		int ret = print_ref_list(kinds, detached, verbose, abbrev,

Shouldn't this error out with a clean error message ("branch name
expected" or so)?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply

* Re: [PATCH 1/3] mergetool--lib: fix startup options for gvimdiff tool
From: Alexey Shumkin @ 2013-01-25  8:44 UTC (permalink / raw)
  To: David Aguilar; +Cc: git, Pat Thoyts, Junio C Hamano
In-Reply-To: <CAJDDKr4Zi-pVVtX4LxRv9K7ocjdpLS_5NH5P_wrx0+ZRSwmfFA@mail.gmail.com>

Maybe, some time ;)
Actually, I'm not TCL-programmer. With one of these patches I just have
solved one my problem (to run tortoisemerge with git-gui) when I
was showing to my collegue how to work with Git, and on the side I
fixed another two bugs. So, I decided to sumbit these patches, to avoid
applying them every time after each Git update as I did last 1.5 years
with other patches which still are not submitted, because I'm too lazy
to follow Git development workflow in my free time )

> On Wed, Jan 23, 2013 at 11:16 PM, Alexey Shumkin
> <alex.crezoff@gmail.com> wrote:
> > Options are taken from <Git source>/mergetools/vim
> >
> > Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
> > ---
> >  git-gui/lib/mergetool.tcl | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> A better long-term solution might be to teach git gui to use "git
> difftool".
> 
> Would it be better to teach git-gui (and gitk) about
> mergetool/difftool? That would allow us to possibly eliminate this
> duplication.
> 
> We did start towards that path when difftool learned the --extcmd
> option (for use by gitk) but I have not followed through.
> 
> What do you think about trying that approach?
> 
> 
> > diff --git a/git-gui/lib/mergetool.tcl b/git-gui/lib/mergetool.tcl
> > index 3c8e73b..4fc1cab 100644
> > --- a/git-gui/lib/mergetool.tcl
> > +++ b/git-gui/lib/mergetool.tcl
> > @@ -211,7 +211,13 @@ proc merge_resolve_tool2 {} {
> >                 }
> >         }
> >         gvimdiff {
> > -               set cmdline [list "$merge_tool_path" -f "$LOCAL"
> > "$MERGED" "$REMOTE"]
> > +               if {$base_stage ne {}} {
> > +                       set cmdline [list "$merge_tool_path" -f -d
> > -c "wincmd J" \
> > +                               "$MERGED" "$LOCAL" "$BASE"
> > "$REMOTE"]
> > +               } else {
> > +                       set cmdline [list "$merge_tool_path" -f -d
> > -c "wincmd l" \
> > +                               "$LOCAL" "$MERGED" "$REMOTE"]
> > +               }
> >         }
> >         kdiff3 {
> >                 if {$base_stage ne {}} {
> > --
> > 1.8.1.1.10.g9255f3f
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe git" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 

^ permalink raw reply

* [PATCH] branch: reject -D/-d without branch name
From: Nguyễn Thái Ngọc Duy @ 2013-01-25  8:26 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/branch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 873f624..1d3e842 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -837,7 +837,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		colopts = 0;
 	}
 
-	if (delete)
+	if (delete && argc)
 		return delete_branches(argc, argv, delete > 1, kinds, quiet);
 	else if (list) {
 		int ret = print_ref_list(kinds, detached, verbose, abbrev,
-- 
1.8.1.1.380.g782aa97

^ permalink raw reply related

* Separately repository access in GitWeb
From: Андрей Баранов @ 2013-01-25  8:10 UTC (permalink / raw)
  To: git

good day.

I`m trying make separately repository access in GitWeb by NGINX

separation of access based on URL strings, namely, the presence of the
query strings:
'?p=repo.git'
with a regular expression:
"^.*p=(.*?)(\.git|;|&|=|\s).*$"

I am wondering how much it is correct to protect against unauthorized access.

Thanks in advance :)

complete example of a configuration file:

server {
        listen 80;

root /home/git/gitweb;

        access_log /var/log/nginx/gitweb.access_log main;
        error_log /var/log/nginx/gitweb.error_log info;

        index gitweb.cgi;
gzip off;

    location ~* \.(jpg|txt|jpeg|gif|png|ico|css|zip|js|swf)$ {
access_log        off;
        expires 1d;
    }

    location = / {
set $htpasswd "opened@";
if ($args ~* "^.*p=(.*?)(\.git|;|&|=|\s).*$") {
set $htpasswd /home/git/.gitolite/conf/$1_htpasswd;
        }
        if (-f $htpasswd) {
                rewrite ^.*$  /closed last;
        }

rewrite ^.*$ /guest last;
    }

    location = /closed {
internal;
access_log /var/log/nginx/gitweb-closed.access_log main;
auth_basic "Unauthorized";
        auth_basic_user_file $htpasswd;
        include fastcgi_params;
        fastcgi_param  SCRIPT_NAME gitweb.cgi;
        fastcgi_param SCRIPT_FILENAME /home/git/gitweb/gitweb.cgi;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }

    location = /guest {
internal;
access_log /var/log/nginx/gitweb-guest.access_log main;
        include fastcgi_params;
fastcgi_param  SCRIPT_NAME gitweb.cgi;
fastcgi_param SCRIPT_FILENAME /home/git/gitweb/gitweb.cgi;
        fastcgi_pass unix:/var/run/fcgiwrap.socket;
    }

    location  / {
        rewrite (.*) / permanent;
    }

}

^ permalink raw reply

* Re: [PATCH] mergetools: Add tortoisegitmerge helper
From: David Aguilar @ 2013-01-25  7:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Sven Strickroth, git, Sebastian Schuberth, Jeff King
In-Reply-To: <7vvcal683y.fsf@alter.siamese.dyndns.org>

On Thu, Jan 24, 2013 at 11:21 PM, Junio C Hamano <gitster@pobox.com> wrote:
> David Aguilar <davvid@gmail.com> writes:
>>>>> This paragraph needs to be rewritten to unconfuse readers.  The
>>>>> original is barely intelligible, and it becomes unreadable as the
>>>>> set of tools subtracted by "minus" and added by "plus" grows.
>>>>
>>>> But I think this should not be part of this patch.
>>>
>>> I agree that it can be done (and it is better to be done) as a
>>> preparatory step.  The current text is barely readable, but with
>>> this patch there will be two "minus", and the result becomes
>>> unreadable at that point.
>>>
>>> It also could be done as a follow-up documentation readability fix.
>>
>> Another thought would be to minimize this section as much
>> as possible and point users to "git difftool --tool-help".
>
> We had a similar discussion here:
>
>   http://thread.gmane.org/gmane.comp.version-control.git/201913/focus=201976
>
> and Documentation/git-{diff,merge}tool.txt have stayed quiet since
> then.
>
> But Documentation/merge-config.txt tries to list everything that _could_
> be enabled, and I do not necessarily think having one single
> location that lists everything is such a bad idea.
>
> Is there a way for me to programatically tell what merge.tool and
> diff.tool could be enabled for a particular source checkout of Git
> regardless of what platform am I on (that is, even though I won't
> touch Windows, I want to see 'tortoise' appear in the output of such
> a procedure)?  We could generate a small text file from the Makefile
> in Documentation and include it when building the manual pages if
> such a procedure is available.

That's a good idea.
Here's one way... (typed into gmail, so probably broken)

LF='
'
mergetools=
difftools=
scriptlets="$(git --exec-path)"/mergetools

for script in "$scriptlets"/*
do
    tool="$(basename "$script")"
    if test "$tool" = "defaults"
    then
        continue
    fi
    . "$scriptlets"/defaults
    can_diff && difftools="$difftools$tool$LF"
    can_merge && mergetools="$mergetools$tool$LF"
done

I can follow up with a Documentation patch along these lines.
I'm would imagine it would be hooked up similarly to how the
command lists are constructed.

This should allow the tortoisemerge improvements to happen independently.
-- 
David

^ permalink raw reply

* Re: segmentation fault (nullpointer) with git log --submodule -p
From: Jonathon Mah @ 2013-01-25  7:32 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Junio C Hamano, Jeff King, Duy Nguyen, Stefan Näwe, Armin,
	git@vger.kernel.org
In-Reply-To: <20130125055331.GC26524@elie.Belkin>

Just to note, the proposals so far don't prevent a "smart-ass" function from freeing the buffer when it's called underneath the use/release scope, as in:

with_commit_buffer(commit); {
	fn1_needing_buffer(commit);
	walk_rev_tree_or_something();
	fn2_needing_buffer(commit);
} done_with_commit_buffer(commit);

walk_rev_tree_or_something() might need to read commits to do its thing, and it could still choose to free their buffers (as in rev-list.c finish_commit()). If those commits includes the one being "retained", the call to fn2 will still see NULL despite it being in a 'protected scope'.

Are the objections to using a reference count?



Jonathon Mah
me@JonathonMah.com

^ permalink raw reply

* Re: segmentation fault (nullpointer) with git log --submodule -p
From: Junio C Hamano @ 2013-01-25  7:27 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Jeff King, Duy Nguyen, Stefan Näwe, Armin, Jonathon Mah,
	git@vger.kernel.org
In-Reply-To: <20130125055331.GC26524@elie.Belkin>

Jonathan Nieder <jrnieder@gmail.com> writes:

> Hi,
>
> Junio C Hamano wrote:
>
>> I've been toying with an idea along this line.
>
> Heh.  Just for fun, here's an uglier version:

Much nicer, though.

>
> 	struct wcb_data {
> 		int had_buffer;
> 		int using_buffer;
> 	};
> 	#define WITH_COMMIT_BUFFER_DATA_INIT { 0, 0 }
>
> 	extern void acquire_commit_buffer(struct commit *, struct wcb_data *);
> 	extern void done_with_commit_buffer(struct commit *, struct wcb_data *);
>
> 	/*
> 	 * usage:
> 	 *	struct wcb_data buf = WITH_COMMIT_BUFFER_INIT;
> 	 *
> 	 *	with_commit_buffer(commit, buf) {
> 	 *		...
> 	 *	}
> 	 */
> 	#define with_commit_buffer(commit, i) \
> 		for (acquire_commit_buffer(commit, &i); \
> 		     i.using_buffer; \
> 		     done_with_commit_buffer(commit, &i))
>
> 	void acquire_commit_buffer(struct commit *commit, struct wcb_data *i)
> 	{
> 		enum object_type type;
> 		unsigned long size;
>
> 		assert(!i->using_buffer);
> 		i->using_buffer = 1;
> 		i->had_buffer = !!commit->buffer;
>
> 		if (i->had_buffer)
> 			return;
> 		commit->buffer = read_sha1_file(commit->object.sha1, &type, &size);
> 		if (!commit->buffer)
> 			die("unable to read commit %s", sha1_to_hex(commit->object.sha1));
> 	}
>
> 	void done_with_commit_buffer(struct commit *commit, struct wcb_data *i)
> 	{
> 		assert(i->using_buffer);
> 		i->using_buffer = 0;
>
> 		if (!i->had_buffer) {
> 			free(commit->buffer);
> 			commit->buffer = NULL;
> 		}
> 	}

^ permalink raw reply

* Re: [PATCH] mergetools: Add tortoisegitmerge helper
From: Junio C Hamano @ 2013-01-25  7:21 UTC (permalink / raw)
  To: David Aguilar; +Cc: Sven Strickroth, git, Sebastian Schuberth, Jeff King
In-Reply-To: <CAJDDKr5O70tTfwuipWcYVJL6gM3bUyQh-22yVO89xn8OFsQOpw@mail.gmail.com>

David Aguilar <davvid@gmail.com> writes:

> Even though the old tortoisemerge and the new tortoisegitmerge
> have completely different syntax, could we still use the existence
> of one when deciding which syntax to use?
> ...
> ...and then later merge_cmd and diff_cmd
> can delegate to {diff,merge}_cmd_legacy() and
> {diff,merge}_cmd_gitmerge() functions to do the work.
>
> It's just a thought.  translate_merge_tool_path()
> is too low-level to do it, but it seems like we could
> get away with it by having some extra smarts in the
> scriptlet.

Sounds like a far better approach to me.  I'd like to at least see
an attempt be made to make that work first.

>>>> This paragraph needs to be rewritten to unconfuse readers.  The
>>>> original is barely intelligible, and it becomes unreadable as the
>>>> set of tools subtracted by "minus" and added by "plus" grows.
>>>
>>> But I think this should not be part of this patch.
>>
>> I agree that it can be done (and it is better to be done) as a
>> preparatory step.  The current text is barely readable, but with
>> this patch there will be two "minus", and the result becomes
>> unreadable at that point.
>>
>> It also could be done as a follow-up documentation readability fix.
>
> Another thought would be to minimize this section as much
> as possible and point users to "git difftool --tool-help".

We had a similar discussion here:

  http://thread.gmane.org/gmane.comp.version-control.git/201913/focus=201976

and Documentation/git-{diff,merge}tool.txt have stayed quiet since
then.

But Documentation/merge-config.txt tries to list everything that _could_
be enabled, and I do not necessarily think having one single
location that lists everything is such a bad idea.

Is there a way for me to programatically tell what merge.tool and
diff.tool could be enabled for a particular source checkout of Git
regardless of what platform am I on (that is, even though I won't
touch Windows, I want to see 'tortoise' appear in the output of such
a procedure)?  We could generate a small text file from the Makefile
in Documentation and include it when building the manual pages if
such a procedure is available.

^ permalink raw reply

* Re: [PATCH] mergetools: Add tortoisegitmerge helper
From: David Aguilar @ 2013-01-25  6:11 UTC (permalink / raw)
  To: Sven Strickroth; +Cc: Junio C Hamano, git, Sebastian Schuberth, Jeff King
In-Reply-To: <7vpq0u8bxd.fsf@alter.siamese.dyndns.org>

On Thu, Jan 24, 2013 at 2:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
>
>> Am 24.01.2013 20:51 schrieb Junio C Hamano:
>>> Sven Strickroth <sven.strickroth@tu-clausthal.de> writes:
>>>
>>>> - The TortoiseGit team renamed TortoiseMerge.exe to TortoiseGitMerge.exe
>>>>   (starting with 1.8.0) in order to make clear that this one has special
>>>>   support for git and prevent confusion with the TortoiseSVN TortoiseMerge
>>>>   version.
>>>
>>> Wouldn't it make more sense in such a situation if your users can
>>> keep using the old "tortoisemerge" configured in their configuration
>>> and when the renamed one is found the mergetool automatically used
>>> it, rather than the way your patch is done?
>>
>> That was also my first idea, however, TortoiseMerge uses parameters as
>> follows: '-base:"$BASE"'. TortoiseGitMerge uses values separated by
>> space from keys: '-base "$BASE"'. So both are incompatible (the first
>> approach has problems with spaces in filenames, the TortoiseGitMerge
>> approach fixes this).
>
> OK.  Please unconfuse future readers of "git log" by saying why such
> a unification does not work in the proposed log message.

Even though the old tortoisemerge and the new tortoisegitmerge
have completely different syntax, could we still use the existence
of one when deciding which syntax to use?

pseudo-code at the top of the scriptlet:

if test -z "$tortoisegitmerge"
then
    if type tortoisegitmerge 2>&1 >/dev/null
    then
        tortoisegitmerge=true
    else
        tortoisegitmerge=false
    fi
fi

...and then later merge_cmd and diff_cmd
can delegate to {diff,merge}_cmd_legacy() and
{diff,merge}_cmd_gitmerge() functions to do the work.

It's just a thought.  translate_merge_tool_path()
is too low-level to do it, but it seems like we could
get away with it by having some extra smarts in the
scriptlet.

>>>> diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt
>>>> index 4314ad0..13cbe5b 100644
>>>> --- a/Documentation/diff-config.txt
>>>> +++ b/Documentation/diff-config.txt
>>>> @@ -151,7 +151,7 @@ diff.<driver>.cachetextconv::
>>>>  diff.tool::
>>>>     The diff tool to be used by linkgit:git-difftool[1].  This
>>>>     option overrides `merge.tool`, and has the same valid built-in
>>>> -   values as `merge.tool` minus "tortoisemerge" and plus
>>>> -   "kompare".  Any other value is treated as a custom diff tool,
>>>> +   values as `merge.tool` minus "tortoisemerge"/"tortoisegitmerge" and
>>>> +   plus "kompare".  Any other value is treated as a custom diff tool,
>>>>     and there must be a corresponding `difftool.<tool>.cmd`
>>>>     option.
>>>
>>> So in short, two tortoises and kompare are only valid as mergetool
>>> but cannot be used as difftool?  No, I am reading it wrong.
>>> merge.tool can be used for both, kompare can be used as difftool,
>>> and two tortoises can only be used as mergetool.
>>>
>>> This paragraph needs to be rewritten to unconfuse readers.  The
>>> original is barely intelligible, and it becomes unreadable as the
>>> set of tools subtracted by "minus" and added by "plus" grows.
>>
>> But I think this should not be part of this patch.
>
> I agree that it can be done (and it is better to be done) as a
> preparatory step.  The current text is barely readable, but with
> this patch there will be two "minus", and the result becomes
> unreadable at that point.
>
> It also could be done as a follow-up documentation readability fix.

Another thought would be to minimize this section as much
as possible and point users to "git difftool --tool-help".

We can then improve --tool-help (there are already preliminary
patches in-flight to do so) so that we do not have to maintain
this documentation in the future.

Likewise, if we are able to teach the scriptlet to choose
the best one (and not require a new scriptlet) then this
section could be left as-is for this patch.
-- 
David

^ permalink raw reply

* [PATCH] .gitignore: ignore generated gitk-git/gitk-wish
From: Nguyễn Thái Ngọc Duy @ 2013-01-25  6:09 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index aa258a6..63d4904 100644
--- a/.gitignore
+++ b/.gitignore
@@ -171,6 +171,7 @@
 /git-whatchanged
 /git-write-tree
 /git-core-*/?*
+/gitk-git/gitk-wish
 /gitweb/GITWEB-BUILD-OPTIONS
 /gitweb/gitweb.cgi
 /gitweb/static/gitweb.js
-- 
1.8.0.rc3.18.g0d9b108

^ permalink raw reply related

* Re: segmentation fault (nullpointer) with git log --submodule -p
From: Jonathan Nieder @ 2013-01-25  5:53 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jeff King, Duy Nguyen, Stefan Näwe, Armin, Jonathon Mah,
	git@vger.kernel.org
In-Reply-To: <7vzjzx7w01.fsf@alter.siamese.dyndns.org>

Hi,

Junio C Hamano wrote:

> I've been toying with an idea along this line.

Heh.  Just for fun, here's an uglier version:

	struct wcb_data {
		int had_buffer;
		int using_buffer;
	};
	#define WITH_COMMIT_BUFFER_DATA_INIT { 0, 0 }

	extern void acquire_commit_buffer(struct commit *, struct wcb_data *);
	extern void done_with_commit_buffer(struct commit *, struct wcb_data *);

	/*
	 * usage:
	 *	struct wcb_data buf = WITH_COMMIT_BUFFER_INIT;
	 *
	 *	with_commit_buffer(commit, buf) {
	 *		...
	 *	}
	 */
	#define with_commit_buffer(commit, i) \
		for (acquire_commit_buffer(commit, &i); \
		     i.using_buffer; \
		     done_with_commit_buffer(commit, &i))

	void acquire_commit_buffer(struct commit *commit, struct wcb_data *i)
	{
		enum object_type type;
		unsigned long size;

		assert(!i->using_buffer);
		i->using_buffer = 1;
		i->had_buffer = !!commit->buffer;

		if (i->had_buffer)
			return;
		commit->buffer = read_sha1_file(commit->object.sha1, &type, &size);
		if (!commit->buffer)
			die("unable to read commit %s", sha1_to_hex(commit->object.sha1));
	}

	void done_with_commit_buffer(struct commit *commit, struct wcb_data *i)
	{
		assert(i->using_buffer);
		i->using_buffer = 0;

		if (!i->had_buffer) {
			free(commit->buffer);
			commit->buffer = NULL;
		}
	}

^ permalink raw reply

* Re: [PATCH 4/4] git-difftool: use git-mergetool--lib for "--tool-help"
From: David Aguilar @ 2013-01-25  5:29 UTC (permalink / raw)
  To: John Keeping; +Cc: git
In-Reply-To: <b791e866c02b0c118f08bde1d7ca6c41d6239989.1359057056.git.john@keeping.me.uk>

On Thu, Jan 24, 2013 at 11:55 AM, John Keeping <john@keeping.me.uk> wrote:
> The "--tool-help" option to git-difftool currently displays incorrect
> output since it uses the names of the files in
> "$GIT_EXEC_PATH/mergetools/" rather than the list of command names in
> git-mergetool--lib.
>
> Fix this by simply delegating the "--tool-help" argument to the
> show_tool_help function in git-mergetool--lib.

Very nice.

One thought I had was that the unified show_tool_help should
probably check TOOL_MODE=diff and skip over the
!can_diff entries.

The current output of "git difftool --tool-help" before your
patches has the problem that it will list tools such as
"tortoisemerge" as "valid but not available" because it
does not differentiate between missing and !can_diff.


> diff --git a/git-difftool.perl b/git-difftool.perl
> index edd0493..0a90de4 100755
> --- a/git-difftool.perl
> +++ b/git-difftool.perl
> @@ -59,57 +59,16 @@ sub find_worktree
>         return $worktree;
>  }
>
> -sub filter_tool_scripts
> -{
> -       my ($tools) = @_;
> -       if (-d $_) {
> -               if ($_ ne ".") {
> -                       # Ignore files in subdirectories
> -                       $File::Find::prune = 1;
> -               }
> -       } else {
> -               if ((-f $_) && ($_ ne "defaults")) {
> -                       push(@$tools, $_);
> -               }
> -       }
> -}
> -
>  sub print_tool_help
>  {
> -       my ($cmd, @found, @notfound, @tools);
> -       my $gitpath = Git::exec_path();
> -
> -       find(sub { filter_tool_scripts(\@tools) }, "$gitpath/mergetools");
> -
> -       foreach my $tool (@tools) {
> -               $cmd  = "TOOL_MODE=diff";
> -               $cmd .= ' && . "$(git --exec-path)/git-mergetool--lib"';
> -               $cmd .= " && get_merge_tool_path $tool >/dev/null 2>&1";
> -               $cmd .= " && can_diff >/dev/null 2>&1";
> -               if (system('sh', '-c', $cmd) == 0) {
> -                       push(@found, $tool);
> -               } else {
> -                       push(@notfound, $tool);
> -               }
> -       }

This is where we conflated can_diff with "is the tool available?".
The nice thing is that the old code did actually check can_diff,
but since it conflated these things it ended up putting them
in the @notfound list.  It should ignore those completely, IMO.

That could be a nice follow-up patch.  What do you think?
-- 
David

^ permalink raw reply

* Re: [PATCH 1/3] mergetool--lib: fix startup options for gvimdiff tool
From: David Aguilar @ 2013-01-25  5:07 UTC (permalink / raw)
  To: Alexey Shumkin; +Cc: git, Pat Thoyts, Junio C Hamano
In-Reply-To: <1359011768-7665-1-git-send-email-Alex.Crezoff@gmail.com>

On Wed, Jan 23, 2013 at 11:16 PM, Alexey Shumkin <alex.crezoff@gmail.com> wrote:
> Options are taken from <Git source>/mergetools/vim
>
> Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
> ---
>  git-gui/lib/mergetool.tcl | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

A better long-term solution might be to teach git gui to use "git difftool".

Would it be better to teach git-gui (and gitk) about mergetool/difftool?
That would allow us to possibly eliminate this duplication.

We did start towards that path when difftool learned the --extcmd
option (for use by gitk) but I have not followed through.

What do you think about trying that approach?


> diff --git a/git-gui/lib/mergetool.tcl b/git-gui/lib/mergetool.tcl
> index 3c8e73b..4fc1cab 100644
> --- a/git-gui/lib/mergetool.tcl
> +++ b/git-gui/lib/mergetool.tcl
> @@ -211,7 +211,13 @@ proc merge_resolve_tool2 {} {
>                 }
>         }
>         gvimdiff {
> -               set cmdline [list "$merge_tool_path" -f "$LOCAL" "$MERGED" "$REMOTE"]
> +               if {$base_stage ne {}} {
> +                       set cmdline [list "$merge_tool_path" -f -d -c "wincmd J" \
> +                               "$MERGED" "$LOCAL" "$BASE" "$REMOTE"]
> +               } else {
> +                       set cmdline [list "$merge_tool_path" -f -d -c "wincmd l" \
> +                               "$LOCAL" "$MERGED" "$REMOTE"]
> +               }
>         }
>         kdiff3 {
>                 if {$base_stage ne {}} {
> --
> 1.8.1.1.10.g9255f3f
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
David

^ permalink raw reply

* Re: [PATCH v4 0/3] Finishing touches to "push" advises
From: Chris Rorvick @ 2013-01-25  5:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jeff King
In-Reply-To: <7va9rx7t0e.fsf@alter.siamese.dyndns.org>

On Thu, Jan 24, 2013 at 11:04 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Would it be sufficient to do this?  I think "the tag already exists
> in the remote" is already clear that we are talking about the
> destination.

Good point.

> diff --git a/builtin/push.c b/builtin/push.c
> index a2b3fbe..78789be 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -228,7 +228,7 @@ static const char message_advice_ref_fetch_first[] =
>            "See the 'Note about fast-forwards' in 'git push --help' for details.");
>
>  static const char message_advice_ref_already_exists[] =
> -       N_("Updates were rejected because the destination reference already exists\n"
> +       N_("Updates were rejected because the tag already exists\n"
>            "in the remote.");
>
>  static const char message_advice_ref_needs_force[] =

Looks like the new-line is now unnecessary, but that looks good to me.

Thanks,

Chris

^ permalink raw reply

* Re: [PATCH v4 0/3] Finishing touches to "push" advises
From: Junio C Hamano @ 2013-01-25  5:04 UTC (permalink / raw)
  To: Chris Rorvick; +Cc: git, Jeff King
In-Reply-To: <CAEUsAPYAikZUTf9OE=PoGBYot6Udnw9XTYDs6Ug7h=PWbCYM1Q@mail.gmail.com>

Chris Rorvick <chris@rorvick.com> writes:

> Had I written the the "already exists" advice in the context of these
> additional statuses I would have said "the destination *tag* reference
> already exists", or maybe even just "the destination *tag* already
> exists".

Yeah, now we do not use "already exists" for anything other than
refs/tags/, right?  Your rewording sounds like the right thing to
make it even clearer.

Thanks for bringing it up.  

Would it be sufficient to do this?  I think "the tag already exists
in the remote" is already clear that we are talking about the
destination.

diff --git a/builtin/push.c b/builtin/push.c
index a2b3fbe..78789be 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -228,7 +228,7 @@ static const char message_advice_ref_fetch_first[] =
 	   "See the 'Note about fast-forwards' in 'git push --help' for details.");
 
 static const char message_advice_ref_already_exists[] =
-	N_("Updates were rejected because the destination reference already exists\n"
+	N_("Updates were rejected because the tag already exists\n"
 	   "in the remote.");
 
 static const char message_advice_ref_needs_force[] =

^ permalink raw reply related

* Re: [PATCH] Update renamed file merge-file.h in Makefile
From: Jiang Xin @ 2013-01-25  4:59 UTC (permalink / raw)
  To: Git List
In-Reply-To: <1359083188-31866-1-git-send-email-worldhello.net@gmail.com>

Oops,  I find it is already fixed in commit
a60521bc6099ce89d05ef2160d2e3c30a106fda7.

commit a60521bc6099ce89d05ef2160d2e3c30a106fda7
Author: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date:   Tue Jan 22 16:47:47 2013 +0000

    Makefile: Replace merge-file.h with merge-blobs.h in LIB_H

    Commit fa2364ec ("Which merge_file() function do you mean?", 06-12-2012)
    renamed the files merge-file.[ch] to merge-blobs.[ch], but forgot to
    rename the header file in the definition of the LIB_H macro.

    Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

(kick back to the list)

2013/1/25 Jiang Xin <worldhello.net@gmail.com>:
> Commit v1.8.1-rc0-3-gfa2364e renamed merge-file.h to merge-blobs.h, but
> forgot to update the reference of merge-file.h in Makefile. This would
> break the build of "po/git.pot", which depends on $(LOCALIZED_C), then
> fallback to the missing file "merge-file.h".
>
> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
> ---
>  Makefile |    2 +-
>  1 个文件被修改,插入 1 行(+),删除 1 行(-)
>
> diff --git a/Makefile b/Makefile
> index 1b30d7b..a786d4c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -649,7 +649,7 @@ LIB_H += list-objects.h
>  LIB_H += ll-merge.h
>  LIB_H += log-tree.h
>  LIB_H += mailmap.h
> -LIB_H += merge-file.h
> +LIB_H += merge-blobs.h
>  LIB_H += merge-recursive.h
>  LIB_H += mergesort.h
>  LIB_H += notes-cache.h
> --
> 1.8.1.1
>

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox