Re: What's cooking in git.git (Jun 2013, #07; Thu, 20)

2013-06-22 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
 Because the implementation is too ugly.

I know :)  The only reason I sent it with code is because I didn't get
any responses to an email without code.  If you agree that it is a
useful feature, we have to figure out a beautiful implementation.

 I would however can imagine an alternative implementation which
 might be more palatable. It may go like this:

 [alias lgF]
 command = log --oneline --boundary --first-parent
 help = show the first parent chain, one line per commit

I'm not sure what value this adds.  If I ever forget what my alias is
called, I `git rp --help` to get the expansion and then look up the
manpage.  It would be ideal if I could `man git lgF` though: I'm sick
of having to type out `man git for-each-ref` everytime I need the
manpage for fer (obviously an unscripted `man` won't work: `git help`
will do the translation).

 completion = log

Again, unsure what value it adds.  I already have plenty of aliases
that complete fine.  The completion only fails if I have an !-command;
in that case, this solution is a hack: we should work towards not
requiring an !-command in the first place.

 so that not just alias.c code can take notice of alias.lgF.command
 to expand it,

How?  Fundamentally, alias_lookup_cb() is a fired off by the
config-parsing infrastructure which calls a tolower() on everything:
alias.c has control over nothing, unless we re-implement the entire
config-parsing infrastructure specifically for aliases (Bad idea).  I
don't see how changing from alias.name to alias.name.command helps
anything, especially when the other alias.name.* keys aren't even
useful.

 but we can later extend it to help git help lgF

Yeah, this is a good idea.

 and
 bash/zsh completion (i.e. they would learn lgF parameter would
 complete in a way similar to 'log' from alias.lgF.completion).

Solved problem: see __git_aliased_command() in git-completion.bash.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/16] t/t5505-remote: modernize subshell-style of one test

2013-06-22 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
 Good, but a style only patch like this should consider taking
 advantage of the occasion to clean up the entire file, as we do not
 often get enough chance to do so without conflicting with in-flight
 topics.  Is there something else that would conflict if this step
 did so?

No, but the problem is that the file contains mixed-style which
prevents me from automating my work with regular-expressions and
macros easily.  I have to break it up into regions and operate
regexps/macros on specific regions, multiplying the number of errors I
can possibly commit.  Nevertheless, I'll do it: I don't want this to
be a maintenance burden for us.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/16] t/t5505-remote: remove dependency on $origin_url

2013-06-22 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
 Is there a reason why quux is better than another randomly chosen
 string $(pwd)/one?

$(pwd)/one is not randomly chosen: that configuration will work with
push/pull, and is therefore misleading.  I put in a deliberately bogus
value because I wanted to make it clear that we're only testing
anything config-parsing.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/16] t/t5516-fetch-push: use test_config()

2013-06-22 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
 That may be a good thing in principle, but I _think_
 [...]
 sequence is used so that we do not even have to worry about what
 leftover configuration values are in the testrepo/.git/config; so
 does it really matter?

Yeah, you're right.  Dropped.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 06/16] t/t5505-remote: test url-with-# in branches-file

2013-06-22 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
 diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
 index fd0a81e..93e11c8 100755
 --- a/t/t5505-remote.sh
 +++ b/t/t5505-remote.sh
 @@ -702,27 +702,42 @@ test_expect_success 'migrate a remote from named file 
 in $GIT_DIR/branches' '
   )
  '

 -test_expect_success 'remote prune to cause a dangling symref' '
 +test_expect_success 'migrate a remote from named file in $GIT_DIR/branches 
 (2)' '
   git clone one seven 
 + origin_url=$(pwd)/one 

 The variable assigned here does not seem to get used.  Is this needed?

Silly error carried over from copy-pasting.  Fixed.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/16] remote: remove dead code in read_branches_file()

2013-06-22 Thread Ramkumar Ramachandra
Junio C Hamano wrote:
 As far as I can tell, that valid-remote-nick was done in df93e33c
 (Validate nicknames of remote branches to prohibit confusing ones,
 2008-02-15), and back in that version, the codepath and the feature
 that wants to see a slash and do magical things, which is described
 by this comment you are removing:

It's a bad hack, in my opinion.  When I say git fetch ../foomery, it
should catch the pattern at transport_get() and not even attempt to
look up a remote in the first place.  I will attempt to clean this up
soon.

 So it appears that back then (and througout to today), nobody uses
 that partial URL feature which is specific (and was a rather nice
 invention/legacy by Cogito) to .git/branches file.

It's quite a cute feature, even if a bit magical.

 Reminds me of the strategy to deprecate functionality in X (cf.
 http://lwn.net/Articles/536520/) ;-)

Leaving dead code around to confuse readers? :\
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/16] t/t5505-remote: test multiple push/pull in remotes-file

2013-06-22 Thread Ramkumar Ramachandra
Eric Sunshine wrote:
 Broken -chain.

Good eyes, thanks.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 00/14] Classify {branches,remotes}-file as fringe features

2013-06-22 Thread Ramkumar Ramachandra
Hi,

Since I didn't explain the series properly last time: this series
reduces the burden of the branches-file/remotes-file cruft.  It does
not argue for deprecation, because it is still useful to some people
and harms nobody.  It removes dead code, tests the feature properly,
and doesn't mention it in obscure places.

In this iteration, [1/14] does a file-wide style cleanup (wasn't as
painful as I thought).  Also, one s/git config/test_config/ patch has
been dropped because it adds no value.  This time, I actually ran all
the tests to make sure that I made no silly mistakes (there were quite
a few last time).

Thanks to Junio and Eric Sunshine for reviews.

Ramkumar Ramachandra (14):
  t/t5505-remote: modernize style
  t/t5505-remote: test push-refspec in branches-file
  t/t5505-remote: use test_path_is_missing
  t/t5505-remote: remove dependency on $origin_url
  remote: remove dead code in read_branches_file()
  t/t5505-remote: test url-with-# in branches-file
  t/t5516-fetch-push: don't use branches-file
  ls-remote doc: fix example invocation on git.git
  ls-remote doc: rewrite repository paragraph
  ls-remote doc: don't encourage use of branches-file
  t/t5505-remote: test multiple push/pull in remotes-file
  t/t5510-fetch: don't use remotes-file
  t/t5515-fetch-merge-logic: don't use {branches,remotes}-file
  remote: add comment about read_{branches,remotes}_file

 Documentation/git-ls-remote.txt |  11 +-
 remote.c|  34 +-
 t/t5505-remote.sh   | 852 ++--
 t/t5510-fetch.sh|   9 +-
 t/t5515-fetch-merge-logic.sh|  28 +-
 t/t5516-fetch-push.sh   |  16 +-
 6 files changed, 516 insertions(+), 434 deletions(-)

-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 14/14] remote: add comment about read_{branches,remotes}_file

2013-06-22 Thread Ramkumar Ramachandra
Explain that they are fringe features.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 remote.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/remote.c b/remote.c
index 128b210..f980928 100644
--- a/remote.c
+++ b/remote.c
@@ -227,6 +227,10 @@ static void add_instead_of(struct rewrite *rewrite, const 
char *instead_of)
rewrite-instead_of_nr++;
 }
 
+/*
+ * Fringe feature.  Modern Git encourages the use of gitconfig instead
+ * of remotes-file.
+ */
 static void read_remotes_file(struct remote *remote)
 {
FILE *f = fopen(git_path(remotes/%s, remote-name), r);
@@ -274,6 +278,10 @@ static void read_remotes_file(struct remote *remote)
fclose(f);
 }
 
+/*
+ * Fringe feature.  Modern Git encourages the use of gitconfig instead
+ * of branches-file.
+ */
 static void read_branches_file(struct remote *remote)
 {
char *frag;
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 10/14] ls-remote doc: don't encourage use of branches-file

2013-06-22 Thread Ramkumar Ramachandra
One outdated example encourages the use of $GIT_DIR/branches files.
Replace it with an equivalent example using a remote.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 Documentation/git-ls-remote.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index 283fc0c..2e22915 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -70,8 +70,8 @@ EXAMPLES
$ git ls-remote http://www.kernel.org/pub/scm/git/git.git master pu rc
5fe978a5381f1fbad26a80e682ddd2a401966740refs/heads/master
c781a84b5204fb294c9ccc79f8b3baceeb32c061refs/heads/pu
-   $ echo http://www.kernel.org/pub/scm/git/git.git .git/branches/public
-   $ git ls-remote --tags public v\*
+   $ git remote add korg http://www.kernel.org/pub/scm/git/git.git
+   $ git ls-remote --tags korg v\*
d6602ec5194c87b0fc87103ca4d67251c76f233arefs/tags/v0.99
f25a265a342aed6041ab0cc484224d9ca54b6f41refs/tags/v0.99.1
c5db5456ae3b0873fc659c19fafdde22313cc441refs/tags/v0.99.2
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 01/14] t/t5505-remote: modernize style

2013-06-22 Thread Ramkumar Ramachandra
Modernize the style of all tests throughout the file:
- Remove spurious blank lines.
- Indent the test body.
- Make sure that all lines end with , to make it easier to spot breaks
  in the chain.
- When executing something in a subshell, put the parenthesis on
  separate lines and indent the body.  Also make sure that the first
  statement in the subshell is a 'cd'.
- When redirecting output, replace the  output forms with output.
- Use the -\EOF and -EOF forms of heredoc, not EOF.  Also, don't
  de-indent the heredoc body.
- When creating an empty file, use : output form over output for
  clarity.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5505-remote.sh | 813 +-
 1 file changed, 440 insertions(+), 373 deletions(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index dd10ff0..f679ded 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -42,107 +42,104 @@ check_tracking_branch () {
 }
 
 test_expect_success setup '
-
setup_repository one 
setup_repository two 
(
-   cd two  git branch another
+   cd two 
+   git branch another
) 
git clone one test
-
 '
 
 test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
-(
-   cd test 
-   tokens_match origin $(git remote) 
-   check_remote_track origin master side 
-   check_tracking_branch origin HEAD master side
-)
+   (
+   cd test 
+   tokens_match origin $(git remote) 
+   check_remote_track origin master side 
+   check_tracking_branch origin HEAD master side
+   )
 '
 
 test_expect_success 'add another remote' '
-(
-   cd test 
-   git remote add -f second ../two 
-   tokens_match origin second $(git remote) 
-   check_tracking_branch second master side another 
-   git for-each-ref --format=%(refname) refs/remotes |
-   sed -e /^refs\/remotes\/origin\//d \
-   -e /^refs\/remotes\/second\//d actual 
-   expect 
-   test_cmp expect actual
-)
+   (
+   cd test 
+   git remote add -f second ../two 
+   tokens_match origin second $(git remote) 
+   check_tracking_branch second master side another 
+   git for-each-ref --format=%(refname) refs/remotes |
+   sed -e /^refs\/remotes\/origin\//d \
+   -e /^refs\/remotes\/second\//d actual 
+   expect 
+   test_cmp expect actual
+   )
 '
 
 test_expect_success C_LOCALE_OUTPUT 'check remote tracking' '
-(
-   cd test 
-   check_remote_track origin master side 
-   check_remote_track second master side another
-)
+   (
+   cd test 
+   check_remote_track origin master side 
+   check_remote_track second master side another
+   )
 '
 
 test_expect_success 'remote forces tracking branches' '
-(
-   cd test 
-   case `git config remote.second.fetch` in
-   +*) true ;;
-*) false ;;
-   esac
-)
+   (
+   cd test 
+   case `git config remote.second.fetch` in
+   +*) true ;;
+*) false ;;
+   esac
+   )
 '
 
 test_expect_success 'remove remote' '
-(
-   cd test 
-   git symbolic-ref refs/remotes/second/HEAD refs/remotes/second/master 
-   git remote rm second
-)
+   (
+   cd test 
+   git symbolic-ref refs/remotes/second/HEAD 
refs/remotes/second/master 
+   git remote rm second
+   )
 '
 
 test_expect_success C_LOCALE_OUTPUT 'remove remote' '
-(
-   cd test 
-   tokens_match origin $(git remote) 
-   check_remote_track origin master side 
-   git for-each-ref --format=%(refname) refs/remotes |
-   sed -e /^refs\/remotes\/origin\//d actual 
-   expect 
-   test_cmp expect actual
-)
+   (
+   cd test 
+   tokens_match origin $(git remote) 
+   check_remote_track origin master side 
+   git for-each-ref --format=%(refname) refs/remotes |
+   sed -e /^refs\/remotes\/origin\//d actual 
+   : expect 
+   test_cmp expect actual
+   )
 '
 
 test_expect_success 'remove remote protects local branches' '
-(
-   cd test 
-   { cat expect1 EOF
-Note: A branch outside the refs/remotes/ hierarchy was not removed;
-to delete it, use:
-  git branch -d master
-EOF
-   } 
-   { cat expect2 EOF
-Note: Some branches outside the refs/remotes/ hierarchy were not removed;
-to delete them, use:
-  git branch -d foobranch
-  git branch -d master
-EOF
-   } 
-   git tag footag 
-   git config --add remote.oops.fetch +refs/*:refs/* 
-   git remote remove oops 2actual1 
-   git branch foobranch 
-   git config --add remote.oops.fetch +refs/*:refs/* 
-   git remote rm oops 2actual2 
- 

[PATCH v2 07/14] t/t5516-fetch-push: don't use branches-file

2013-06-22 Thread Ramkumar Ramachandra
Four tests exercising fetch and push functionality unnecessarily depend
on $GIT_DIR/branches files.  Modern Git does not encourage the use of
those files, and the parser remote.c:read_branches_file() is only
provided for backward compatibility with older repositories.  We already
have tests in t/t5505-remote to verify that the parser works: so,
substitute the $GIT_DIR/branches configuration with an equivalent
gitconfig-style configuration, using the results of those tests.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5516-fetch-push.sh | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 4691d51..6e9fa84 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -852,9 +852,11 @@ test_expect_success 'fetch with branches' '
mk_empty testrepo 
git branch second $the_first_commit 
git checkout second 
-   echo ..  testrepo/.git/branches/branch1 
(
cd testrepo 
+   test_config remote.branch1.url ..  
+   test_config remote.branch1.fetch 
refs/heads/master:refs/heads/branch1  
+   test_config remote.branch1.push HEAD:refs/heads/master  
git fetch branch1 
echo $the_commit commitrefs/heads/branch1 expect 
git for-each-ref refs/heads actual 
@@ -865,9 +867,11 @@ test_expect_success 'fetch with branches' '
 
 test_expect_success 'fetch with branches containing #' '
mk_empty testrepo 
-   echo ..#second  testrepo/.git/branches/branch2 
(
cd testrepo 
+   test_config remote.branch2.url ..  
+   test_config remote.branch2.fetch 
refs/heads/second:refs/heads/branch2  
+   test_config remote.branch2.push HEAD:refs/heads/second  
git fetch branch2 
echo $the_first_commit commit  refs/heads/branch2 expect 
git for-each-ref refs/heads actual 
@@ -879,7 +883,9 @@ test_expect_success 'fetch with branches containing #' '
 test_expect_success 'push with branches' '
mk_empty testrepo 
git checkout second 
-   echo testrepo  .git/branches/branch1 
+   test_config remote.branch1.url testrepo 
+   test_config remote.branch1.fetch refs/heads/master:refs/heads/branch1 

+   test_config remote.branch1.push HEAD:refs/heads/master 
git push branch1 
(
cd testrepo 
@@ -891,7 +897,9 @@ test_expect_success 'push with branches' '
 
 test_expect_success 'push with branches containing #' '
mk_empty testrepo 
-   echo testrepo#branch3  .git/branches/branch2 
+   test_config remote.branch2.url testrepo 
+   test_config remote.branch2.fetch 
refs/heads/branch3:refs/heads/branch2 
+   test_config remote.branch2.push HEAD:refs/heads/branch3 
git push branch2 
(
cd testrepo 
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 13/14] t/t5515-fetch-merge-logic: don't use {branches,remotes}-file

2013-06-22 Thread Ramkumar Ramachandra
Replace it with the equivalent gitconfig configuration, using the
results of the corresponding tests in t/t5505-remote.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5515-fetch-merge-logic.sh | 28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh
index dbb927d..cde44e0 100755
--- a/t/t5515-fetch-merge-logic.sh
+++ b/t/t5515-fetch-merge-logic.sh
@@ -55,27 +55,25 @@ test_expect_success setup '
git config remote.config-glob.fetch refs/heads/*:refs/remotes/rem/* 
remotes=$remotes config-glob 
 
-   mkdir -p .git/remotes 
-   {
-   echo URL: ../.git/
-   echo Pull: refs/heads/master:remotes/rem/master
-   echo Pull: refs/heads/one:remotes/rem/one
-   echo Pull: two:remotes/rem/two
-   echo Pull: refs/heads/three:remotes/rem/three
-   } .git/remotes/remote-explicit 
+   git config remote.remote-explicit.url ../.git/ 
+   git config remote.remote-explicit.fetch 
refs/heads/master:remotes/rem/master 
+   git config --add remote.remote-explicit.fetch 
refs/heads/one:remotes/rem/one 
+   git config --add remote.remote-explicit.fetch two:remotes/rem/two 
+   git config --add remote.remote-explicit.fetch 
refs/heads/three:remotes/rem/three 
remotes=$remotes remote-explicit 
 
-   {
-   echo URL: ../.git/
-   echo Pull: refs/heads/*:refs/remotes/rem/*
-   } .git/remotes/remote-glob 
+   git config remote.remote-glob.url ../.git/ 
+   git config remote.remote-glob.fetch refs/heads/*:refs/remotes/rem/* 
remotes=$remotes remote-glob 
 
-   mkdir -p .git/branches 
-   echo ../.git  .git/branches/branches-default 
+   git config remote.branches-default.url ../.git/ 
+   git config remote.branches-default.fetch 
refs/heads/master:refs/heads/branches-default 
+   git config remote.branches-default.push HEAD:refs/heads/master 
remotes=$remotes branches-default 
 
-   echo ../.git#one  .git/branches/branches-one 
+   git config remote.branches-one.url ../.git/ 
+   git config remote.branches-one.fetch 
refs/heads/one:refs/heads/branches-one 
+   git config remote.branches-one.push HEAD:refs/heads/one 
remotes=$remotes branches-one 
 
for remote in $remotes ; do
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 06/14] t/t5505-remote: test url-with-# in branches-file

2013-06-22 Thread Ramkumar Ramachandra
Add one more test similar to migrate a remote from named file in
$GIT_DIR/branches to check that a url with a # can be used to specify
the branch name (as opposed to the constant master).

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5505-remote.sh | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 13199d1..229a89c 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -767,27 +767,41 @@ test_expect_success 'migrate a remote from named file in 
$GIT_DIR/branches' '
)
 '
 
-test_expect_success 'remote prune to cause a dangling symref' '
+test_expect_success 'migrate a remote from named file in $GIT_DIR/branches 
(2)' '
git clone one seven 
(
+   cd seven 
+   git remote rm origin 
+   echo quux#foom  .git/branches/origin 
+   git remote rename origin origin 
+   test_path_is_missing .git/branches/origin 
+   test $(git config remote.origin.url) = quux 
+   test $(git config remote.origin.fetch) = 
refs/heads/foom:refs/heads/origin
+   test $(git config remote.origin.push) = HEAD:refs/heads/foom
+   )
+'
+
+test_expect_success 'remote prune to cause a dangling symref' '
+   git clone one eight 
+   (
cd one 
git checkout side2 
git branch -D master
) 
(
-   cd seven 
+   cd eight 
git remote prune origin
) err 21 
test_i18ngrep has become dangling err 
 
: And the dangling symref will not cause other annoying errors 
(
-   cd seven 
+   cd eight 
git branch -a
) 2err 
! grep points nowhere err 
(
-   cd seven 
+   cd eight 
test_must_fail git branch nomore origin
) 2err 
grep dangling symref err
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 05/14] remote: remove dead code in read_branches_file()

2013-06-22 Thread Ramkumar Ramachandra
The first line of the function checks that the remote-name contains a
slash ('/'), and sets the slash variable accordingly.  The only caller
of read_branches_file() is remote_get_1(); the calling codepath is
guarded by valid_remote_nick(), which checks that the remote does not
contain a slash.  Therefore, the slash variable can never be set:
remove the dead code that assumes otherwise.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 remote.c | 26 +++---
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/remote.c b/remote.c
index e71f66d..128b210 100644
--- a/remote.c
+++ b/remote.c
@@ -276,10 +276,9 @@ static void read_remotes_file(struct remote *remote)
 
 static void read_branches_file(struct remote *remote)
 {
-   const char *slash = strchr(remote-name, '/');
char *frag;
struct strbuf branch = STRBUF_INIT;
-   int n = slash ? slash - remote-name : 1000;
+   int n = 1000;
FILE *f = fopen(git_path(branches/%.*s, n, remote-name), r);
char *s, *p;
int len;
@@ -299,36 +298,17 @@ static void read_branches_file(struct remote *remote)
while (isspace(p[-1]))
*--p = 0;
len = p - s;
-   if (slash)
-   len += strlen(slash);
p = xmalloc(len + 1);
strcpy(p, s);
-   if (slash)
-   strcat(p, slash);
 
-   /*
-* With slash, e.g. git fetch jgarzik/netdev-2.6 when
-* reading from $GIT_DIR/branches/jgarzik fetches HEAD from
-* the partial URL obtained from the branches file plus
-* /netdev-2.6 and does not store it in any tracking ref.
-* #branch specifier in the file is ignored.
-*
-* Otherwise, the branches file would have URL and optionally
-* #branch specified.  The master (or specified) branch is
-* fetched and stored in the local branch of the same name.
-*/
frag = strchr(p, '#');
if (frag) {
*(frag++) = '\0';
strbuf_addf(branch, refs/heads/%s, frag);
} else
strbuf_addstr(branch, refs/heads/master);
-   if (!slash) {
-   strbuf_addf(branch, :refs/heads/%s, remote-name);
-   } else {
-   strbuf_reset(branch);
-   strbuf_addstr(branch, HEAD:);
-   }
+
+   strbuf_addf(branch, :refs/heads/%s, remote-name);
add_url_alias(remote, p);
add_fetch_refspec(remote, strbuf_detach(branch, NULL));
/*
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 03/14] t/t5505-remote: use test_path_is_missing

2013-06-22 Thread Ramkumar Ramachandra
Replace instances of ! test -f with test_path_is_missing.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5505-remote.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 74ddd77..d688662 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -747,7 +747,7 @@ test_expect_success 'migrate a remote from named file in 
$GIT_DIR/remotes' '
mkdir -p .git/remotes 
cat ../remotes_origin .git/remotes/origin 
git remote rename origin origin 
-   ! test -f .git/remotes/origin 
+   test_path_is_missing .git/remotes/origin 
test $(git config remote.origin.url) = $origin_url 
test $(git config remote.origin.push) = 
refs/heads/master:refs/heads/upstream 
test $(git config remote.origin.fetch) = 
refs/heads/master:refs/heads/origin
@@ -762,7 +762,7 @@ test_expect_success 'migrate a remote from named file in 
$GIT_DIR/branches' '
git remote rm origin 
echo $origin_url .git/branches/origin 
git remote rename origin origin 
-   ! test -f .git/branches/origin 
+   test_path_is_missing .git/branches/origin 
test $(git config remote.origin.url) = $origin_url 
test $(git config remote.origin.fetch) = 
refs/heads/master:refs/heads/origin 
test $(git config remote.origin.push) = 
HEAD:refs/heads/master
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 04/14] t/t5505-remote: remove dependency on $origin_url

2013-06-22 Thread Ramkumar Ramachandra
In the tests migrate a remote from named file in
$GIT_DIR/{remotes,branches}, we are only checking that a configuration
is migrated successfully; it has no correspondence with whether or not
those values do something sensible with other git
operations (fetch/push).  Therefore, there is no need to determine
$origin_url: just substitute it with the constant value quux.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5505-remote.sh | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index d688662..13199d1 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -733,14 +733,13 @@ test_expect_success 'rename a remote with name prefix of 
other remote' '
 '
 
 cat remotes_origin -EOF
-URL: $(pwd)/one
+URL: quux
 Push: refs/heads/master:refs/heads/upstream
 Pull: refs/heads/master:refs/heads/origin
 EOF
 
 test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
git clone one five 
-   origin_url=$(pwd)/one 
(
cd five 
git remote remove origin 
@@ -748,7 +747,7 @@ test_expect_success 'migrate a remote from named file in 
$GIT_DIR/remotes' '
cat ../remotes_origin .git/remotes/origin 
git remote rename origin origin 
test_path_is_missing .git/remotes/origin 
-   test $(git config remote.origin.url) = $origin_url 
+   test $(git config remote.origin.url) = quux 
test $(git config remote.origin.push) = 
refs/heads/master:refs/heads/upstream 
test $(git config remote.origin.fetch) = 
refs/heads/master:refs/heads/origin
)
@@ -756,14 +755,13 @@ test_expect_success 'migrate a remote from named file in 
$GIT_DIR/remotes' '
 
 test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
git clone one six 
-   origin_url=$(pwd)/one 
(
cd six 
git remote rm origin 
-   echo $origin_url .git/branches/origin 
+   echo quux .git/branches/origin 
git remote rename origin origin 
test_path_is_missing .git/branches/origin 
-   test $(git config remote.origin.url) = $origin_url 
+   test $(git config remote.origin.url) = quux 
test $(git config remote.origin.fetch) = 
refs/heads/master:refs/heads/origin 
test $(git config remote.origin.push) = 
HEAD:refs/heads/master
)
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 11/14] t/t5505-remote: test multiple push/pull in remotes-file

2013-06-22 Thread Ramkumar Ramachandra
Extend the test migrate a remote from named file in $GIT_DIR/remotes
to test that multiple Push: and Pull: lines in the remotes-file
works as expected.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5505-remote.sh | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 229a89c..6a622fc 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -735,7 +735,9 @@ test_expect_success 'rename a remote with name prefix of 
other remote' '
 cat remotes_origin -EOF
 URL: quux
 Push: refs/heads/master:refs/heads/upstream
+Push: refs/heads/master:refs/heads/upstream2
 Pull: refs/heads/master:refs/heads/origin
+Pull: refs/heads/master:refs/heads/origin2
 EOF
 
 test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
@@ -748,8 +750,18 @@ test_expect_success 'migrate a remote from named file in 
$GIT_DIR/remotes' '
git remote rename origin origin 
test_path_is_missing .git/remotes/origin 
test $(git config remote.origin.url) = quux 
-   test $(git config remote.origin.push) = 
refs/heads/master:refs/heads/upstream 
-   test $(git config remote.origin.fetch) = 
refs/heads/master:refs/heads/origin
+   cat push_expected -\EOF 
+   refs/heads/master:refs/heads/upstream
+   refs/heads/master:refs/heads/upstream2
+   EOF
+   cat fetch_expected -\EOF 
+   refs/heads/master:refs/heads/origin
+   refs/heads/master:refs/heads/origin2
+   EOF
+   git config --get-all remote.origin.push push_actual 
+   git config --get-all remote.origin.fetch fetch_actual 
+   test_cmp push_expected push_actual 
+   test_cmp fetch_expected fetch_actual
)
 '
 
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 09/14] ls-remote doc: rewrite repository paragraph

2013-06-22 Thread Ramkumar Ramachandra
Replace the repository paragraph containing specific references to
$GIT_DIR/branches and . with a generic urls-or-remotes paragraph
referencing the relevant sections in the git-fetch(1) manpage.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 Documentation/git-ls-remote.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index cce4f93..283fc0c 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -48,9 +48,9 @@ OPTIONS
exit without talking to the remote.
 
 repository::
-   Location of the repository.  The shorthand defined in
-   $GIT_DIR/branches/ can be used. Use . (dot) to list references in
-   the local repository.
+   The remote repository to query.  This parameter can be
+   either a URL or the name of a remote (see the GIT URLS and
+   REMOTES sections of linkgit:git-fetch[1]).
 
 refs...::
When unspecified, all references, after filtering done
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 12/14] t/t5510-fetch: don't use remotes-file

2013-06-22 Thread Ramkumar Ramachandra
Replace it with the equivalent gitconfig configuration, using the
results of a test in t/t5505-remote.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5510-fetch.sh | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index fde6891..47aeac2 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -46,12 +46,9 @@ test_expect_success clone and setup child repos '
cd three 
git config branch.master.remote two 
git config branch.master.merge refs/heads/one 
-   mkdir -p .git/remotes 
-   {
-   echo URL: ../two/.git/
-   echo Pull: refs/heads/master:refs/heads/two
-   echo Pull: refs/heads/one:refs/heads/one
-   } .git/remotes/two
+   git config remote.two.url ../two/.git/ 
+   git config remote.two.fetch refs/heads/master:refs/heads/two 

+   git config --add remote.two.fetch 
refs/heads/one:refs/heads/one
) 
git clone . bundle 
git clone . seven
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 08/14] ls-remote doc: fix example invocation on git.git

2013-06-22 Thread Ramkumar Ramachandra
Under the EXAMPLES section, there is one invocation on the git.git
repository that attempts to list the refs master, pu, and rc.  The ref
rc does not exist in today's repository, so remove it.  Among other
things, this example demonstrates that the refs... argument is
simply a filter; requesting a non-existent ref is not an error.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 Documentation/git-ls-remote.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index 774de5e..cce4f93 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -70,7 +70,6 @@ EXAMPLES
$ git ls-remote http://www.kernel.org/pub/scm/git/git.git master pu rc
5fe978a5381f1fbad26a80e682ddd2a401966740refs/heads/master
c781a84b5204fb294c9ccc79f8b3baceeb32c061refs/heads/pu
-   b1d096f2926c4e37c9c0b6a7bf2119bedaa277cbrefs/heads/rc
$ echo http://www.kernel.org/pub/scm/git/git.git .git/branches/public
$ git ls-remote --tags public v\*
d6602ec5194c87b0fc87103ca4d67251c76f233arefs/tags/v0.99
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 02/14] t/t5505-remote: test push-refspec in branches-file

2013-06-22 Thread Ramkumar Ramachandra
The test migrate a remote from named file in $GIT_DIR/branches reads
the branches-file, but only checks that the url and fetch-refspec are
set correctly.  Check that the push-refspec is also set correctly.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5505-remote.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index f679ded..74ddd77 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -764,7 +764,8 @@ test_expect_success 'migrate a remote from named file in 
$GIT_DIR/branches' '
git remote rename origin origin 
! test -f .git/branches/origin 
test $(git config remote.origin.url) = $origin_url 
-   test $(git config remote.origin.fetch) = 
refs/heads/master:refs/heads/origin
+   test $(git config remote.origin.fetch) = 
refs/heads/master:refs/heads/origin 
+   test $(git config remote.origin.push) = 
HEAD:refs/heads/master
)
 '
 
-- 
1.8.3.1.498.gacf2885

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] completion: complete rebase --edit-todo

2013-06-22 Thread Ramkumar Ramachandra
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash 
b/contrib/completion/git-completion.bash
index fd9a1d5..43c6226 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1624,7 +1624,7 @@ _git_rebase ()
--preserve-merges --stat --no-stat
--committer-date-is-author-date --ignore-date
--ignore-whitespace --whitespace=
-   --autosquash
+   --autosquash --edit-todo

 
return
-- 
1.8.3.1.487.gd3dfebf.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] clone: regression in error messages in master

2013-06-22 Thread John Szakmeister
On Fri, Jun 21, 2013 at 1:11 PM, Junio C Hamano gits...@pobox.com wrote:
 John Szakmeister j...@szakmeister.net writes:
[snip]
 I can see where this is confusing, but can also see how it's useful
 information to have.  On clone, it's probably not that useful since
 you're looking right at the url, but I could see that information
 being more useful on a pull or push with the default arguments (when
 the source and destination aren't quite as obvious).

 The extra error messages is not the first one, but the last one,
 and the suggested revert is a proposal to remove the latter, not the
 repository $URL not found.

Sorry for the confusion.  I realize they were talking about removing
the remote helper line.  What I meant was that with the url there,
it's a bit easier to determine which part of git failed (http, hg, or
bzr remote helper, for instance).  What I was trying to say was
perhaps there are paths through here where it's really helpful to know
that things failed in the remote helper, so we may not want to
wholesale remove it.  Some of remote helpers, such as ones that talk
to foreign VCSes, do quite a bit more than just transfer data, so it
might be helpful to know that it's not core git that's failing but the
remote helper.  Seeing the URL is a reminder that you're interacting
with a remote helper, and it may not be helpful there.  But other
commands don't necessarily show that to you, and it may be more
helpful to have that reminder that it was a remote helper that failed.

I hope that makes more sense.

-John
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 08/16] t/t5516-fetch-push: use test_config()

2013-06-22 Thread Johannes Sixt
Am 22.06.2013 00:32, schrieb Junio C Hamano:
 Ramkumar Ramachandra artag...@gmail.com writes:
 
 Replace the 'git config' calls in tests with test_config for greater
 robustness.
 
 That may be a good thing in principle, but I _think_
 
   mk_empty testrepo 
 (
   cd testrepo 
 do whatever to its config 
 run test
   )
 
 sequence is used so that we do not even have to worry about what
 leftover configuration values are in the testrepo/.git/config; so
 does it really matter?
 
 If this conversion had something more than s/git config/test_config/
 replacement, that would indicate that you uncovered a bug in the
 existing test and found a good fix, but that does not seem to be the
 case for this particular patch.

And just let me add that the added benefit of test_config to remove the
configuration change after the test case finished would not work because
the test_when_finished registration that happens behind the scenes would
be forgotten when the sub-shell exits.

 @@ -142,8 +142,8 @@ test_expect_success 'fetch with wildcard' '
  mk_empty testrepo 
  (
  cd testrepo 
 -git config remote.up.url .. 
 -git config remote.up.fetch refs/heads/*:refs/remotes/origin/* 
 
 +test_config remote.up.url .. 
 +test_config remote.up.fetch 
 refs/heads/*:refs/remotes/origin/* 
  git fetch up 
...

-- Hannes

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fast-import bug?

2013-06-22 Thread John Keeping
On Fri, Jun 21, 2013 at 02:21:47AM -0700, Dave Abrahams wrote:
 The docs for fast-import seem to imply that I can use ls to get the
 SHA1 of a commit for which I have a mark:
 
Reading from a named tree
The dataref can be a mark reference (:idnum) or the full 
 40-byte
SHA-1 of a Git tag, commit, or tree object, preexisting or waiting 
 to
be written. The path is relative to the top level of the tree 
 named by
dataref.
 
'ls' SP dataref SP path LF
 
See filemodify above for a detailed description of path.
 
Output uses the same format as git ls-tree tree -- path:
 
mode SP ('blob' | 'tree' | 'commit') SP dataref HT path LF
 
The dataref represents the blob, tree, or commit object at path and
^^
can be used in later cat-blob, filemodify, or ls commands.
 
 but I can't get it to work.  It's not entirely clear it's supposed to
 work.  What path would I pass?  Passing an empty path simply causes git
 to report missing .

Which version of Git are you using?  I just tried this and get the error
fatal: Empty path component found in input, which seems to be from
commit 178e1de (fast-import: don't allow 'ls' of path with empty
components, 2012-03-09), which is included in Git 1.7.9.5.

It seems to be slightly more complicated than that though, because after
allowing empty trees I get the missing message for the root tree.
This seems to be because its mode is 0 and not S_IFDIR.

With the patch below, things are working as I expect but I don't
understand why the mode of the root is not set correctly at this point.
Perhaps someone more familiar with fast-import will have some insight...

-- 8 --
diff --git a/fast-import.c b/fast-import.c
index 23f625f..bcce651 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1626,6 +1626,15 @@ del_entry:
return 1;
 }
 
+static void copy_tree_entry(struct tree_entry *dst, struct tree_entry *src)
+{
+   memcpy(dst, src, sizeof(*dst));
+   if (src-tree  is_null_sha1(src-versions[1].sha1))
+   dst-tree = dup_tree_content(src-tree);
+   else
+   dst-tree = NULL;
+}
+
 static int tree_content_get(
struct tree_entry *root,
const char *p,
@@ -1651,11 +1660,7 @@ static int tree_content_get(
e = t-entries[i];
if (e-name-str_len == n  !strncmp_icase(p, 
e-name-str_dat, n)) {
if (!slash1) {
-   memcpy(leaf, e, sizeof(*leaf));
-   if (e-tree  
is_null_sha1(e-versions[1].sha1))
-   leaf-tree = dup_tree_content(e-tree);
-   else
-   leaf-tree = NULL;
+   copy_tree_entry(leaf, e);
return 1;
}
if (!S_ISDIR(e-versions[1].mode))
@@ -3065,7 +3070,11 @@ static void parse_ls(struct branch *b)
die(Garbage after path in: %s, command_buf.buf);
p = uq.buf;
}
-   tree_content_get(root, p, leaf);
+   if (!*p) {
+   copy_tree_entry(leaf, root);
+   leaf.versions[1].mode = S_IFDIR;
+   } else
+   tree_content_get(root, p, leaf);
/*
 * A directory in preparation would have a sha1 of zero
 * until it is saved.  Save, for simplicity.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] completion: learn about --man-path

2013-06-22 Thread John Keeping
Signed-off-by: John Keeping j...@keeping.me.uk
---
 contrib/completion/git-completion.bash | 2 ++
 t/t9902-completion.sh  | 1 +
 2 files changed, 3 insertions(+)

diff --git a/contrib/completion/git-completion.bash 
b/contrib/completion/git-completion.bash
index 8fbf941..c3290af 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2513,11 +2513,13 @@ __git_main ()
--exec-path
--exec-path=
--html-path
+   --man-path
--info-path
--work-tree=
--namespace=
--no-replace-objects
--help
+   -c

;;
*) __git_compute_porcelain_commands
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 81a1657..14d605a 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -231,6 +231,7 @@ test_expect_success 'double dash git itself' '
--exec-path Z
--exec-path=
--html-path Z
+   --man-path Z
--info-path Z
--work-tree=
--namespace=
-- 
1.8.3.1.676.gaae6535

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] completion: handle unstuck form of base git options

2013-06-22 Thread John Keeping
git-completion.bash's parsing of the command name relies on everything
preceding it starting with '-' unless it is the -c option.  This
allows users to use the stuck form of --work-tree=path and
--namespace=path but not the unstuck forms --work-tree path and
--namespace path.  Fix this.

Similarly, the completion only handles the stuck form --git-dir=path
and not --git-dir path, so fix this as well.

Signed-off-by: John Keeping j...@keeping.me.uk
---
 contrib/completion/git-completion.bash | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash 
b/contrib/completion/git-completion.bash
index 6c3bafe..8fbf941 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2492,9 +2492,10 @@ __git_main ()
i=${words[c]}
case $i in
--git-dir=*) __git_dir=${i#--git-dir=} ;;
+   --git-dir)   ((c++)) ; __git_dir=${words[c]} ;;
--bare)  __git_dir=. ;;
--help) command=help; break ;;
-   -c) c=$((++c)) ;;
+   -c|--work-tree|--namespace) ((c++)) ;;
-*) ;;
*) command=$i; break ;;
esac
-- 
1.8.3.1.676.gaae6535

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] help: introduce man.viewer = eman

2013-06-22 Thread Ramkumar Ramachandra
Corresponding to woman.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 Documentation/git-help.txt |  3 +++
 builtin/help.c | 11 ---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
index b21e9d7..0cb4c46 100644
--- a/Documentation/git-help.txt
+++ b/Documentation/git-help.txt
@@ -104,6 +104,9 @@ The 'man.viewer' config variable will be checked if the 
'man' format
 is chosen. The following values are currently supported:
 
 * man: use the 'man' program as usual,
+* eman: use 'emacsclient' to launch the man mode in emacs
+(this only works starting with emacsclient versions 22), on systems
+with man,
 * woman: use 'emacsclient' to launch the woman mode in emacs
 (this only works starting with emacsclient versions 22),
 * konqueror: use 'kfmclient' to open the man page in a new konqueror
diff --git a/builtin/help.c b/builtin/help.c
index 062957f..7cb44e0 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -120,7 +120,7 @@ static int check_emacsclient_version(void)
return 0;
 }
 
-static void exec_woman_emacs(const char *path, const char *page)
+static void exec_woman_emacs(const char *path, const char *page, int eman)
 {
if (!check_emacsclient_version()) {
/* This works only with emacsclient version = 22. */
@@ -128,7 +128,10 @@ static void exec_woman_emacs(const char *path, const char 
*page)
 
if (!path)
path = emacsclient;
-   strbuf_addf(man_page, (woman \%s\), page);
+   if (eman)
+   strbuf_addf(man_page, (man \%s\), page);
+   else
+   strbuf_addf(man_page, (woman \%s\), page);
execlp(path, emacsclient, -e, man_page.buf, (char *)NULL);
warning(_(failed to exec '%s': %s), path, strerror(errno));
}
@@ -341,8 +344,10 @@ static void exec_viewer(const char *name, const char *page)
 
if (!strcasecmp(name, man))
exec_man_man(info, page);
+   else if (!strcasecmp(name, eman))
+   exec_woman_emacs(info, page, 1);
else if (!strcasecmp(name, woman))
-   exec_woman_emacs(info, page);
+   exec_woman_emacs(info, page, 0);
else if (!strcasecmp(name, konqueror))
exec_man_konqueror(info, page);
else if (info)
-- 
1.8.3.1.487.g3e7a5b4.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] completion: complete rebase --edit-todo

2013-06-22 Thread Ramkumar Ramachandra
Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 contrib/completion/git-completion.bash | 4 
 1 file changed, 4 insertions(+)

diff --git a/contrib/completion/git-completion.bash 
b/contrib/completion/git-completion.bash
index 6c3bafe..b51c9e3 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1609,6 +1609,10 @@ _git_rebase ()
 {
local dir=$(__gitdir)
if [ -d $dir/rebase-apply ] || [ -d $dir/rebase-merge ]; then
+   if [ -e $dir/rebase-merge/interactive ]; then
+   __gitcomp --continue --skip --abort --edit-todo
+   return
+   fi
__gitcomp --continue --skip --abort
return
fi
-- 
1.8.3.1.487.g3e7a5b4.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] help: introduce man.viewer = eman

2013-06-22 Thread John Keeping
On Sat, Jun 22, 2013 at 05:13:29PM +0530, Ramkumar Ramachandra wrote:
 Corresponding to woman.
 
 Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
 ---
  Documentation/git-help.txt |  3 +++
  builtin/help.c | 11 ---
  2 files changed, 11 insertions(+), 3 deletions(-)
 
 diff --git a/Documentation/git-help.txt b/Documentation/git-help.txt
 index b21e9d7..0cb4c46 100644
 --- a/Documentation/git-help.txt
 +++ b/Documentation/git-help.txt
 @@ -104,6 +104,9 @@ The 'man.viewer' config variable will be checked if the 
 'man' format
  is chosen. The following values are currently supported:
  
  * man: use the 'man' program as usual,
 +* eman: use 'emacsclient' to launch the man mode in emacs
 +(this only works starting with emacsclient versions 22), on systems
 +with man,
  * woman: use 'emacsclient' to launch the woman mode in emacs
  (this only works starting with emacsclient versions 22),
  * konqueror: use 'kfmclient' to open the man page in a new konqueror
 diff --git a/builtin/help.c b/builtin/help.c
 index 062957f..7cb44e0 100644
 --- a/builtin/help.c
 +++ b/builtin/help.c
 @@ -120,7 +120,7 @@ static int check_emacsclient_version(void)
   return 0;
  }
  
 -static void exec_woman_emacs(const char *path, const char *page)
 +static void exec_woman_emacs(const char *path, const char *page, int eman)
  {
   if (!check_emacsclient_version()) {
   /* This works only with emacsclient version = 22. */
 @@ -128,7 +128,10 @@ static void exec_woman_emacs(const char *path, const 
 char *page)
  
   if (!path)
   path = emacsclient;
 - strbuf_addf(man_page, (woman \%s\), page);
 + if (eman)
 + strbuf_addf(man_page, (man \%s\), page);
 + else
 + strbuf_addf(man_page, (woman \%s\), page);

Would it be nicer to pass a string in here instead of a flag?  Then this
becomes:

strbuf_addf(man_page, (%s \%s\), command, page);

You should probably also rename this function to exec_emacsclient or
something as well now that it doesn't just launch woman.

   execlp(path, emacsclient, -e, man_page.buf, (char *)NULL);
   warning(_(failed to exec '%s': %s), path, strerror(errno));
   }
 @@ -341,8 +344,10 @@ static void exec_viewer(const char *name, const char 
 *page)
  
   if (!strcasecmp(name, man))
   exec_man_man(info, page);
 + else if (!strcasecmp(name, eman))
 + exec_woman_emacs(info, page, 1);
   else if (!strcasecmp(name, woman))
 - exec_woman_emacs(info, page);
 + exec_woman_emacs(info, page, 0);
   else if (!strcasecmp(name, konqueror))
   exec_man_konqueror(info, page);
   else if (info)
 -- 
 1.8.3.1.487.g3e7a5b4.dirty
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] help: introduce man.viewer = eman

2013-06-22 Thread Ramkumar Ramachandra
John Keeping wrote:
 Would it be nicer to pass a string in here instead of a flag?  Then this
 becomes:

 strbuf_addf(man_page, (%s \%s\), command, page);

 You should probably also rename this function to exec_emacsclient or
 something as well now that it doesn't just launch woman.

Sure, will do both.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] completion: handle unstuck form of base git options

2013-06-22 Thread SZEDER Gábor
Hi,

On Sat, Jun 22, 2013 at 12:25:17PM +0100, John Keeping wrote:
 git-completion.bash's parsing of the command name relies on everything
 preceding it starting with '-' unless it is the -c option.  This
 allows users to use the stuck form of --work-tree=path and
 --namespace=path but not the unstuck forms --work-tree path and
 --namespace path.  Fix this.

I never use these commands, so I looked up what --namespace means.
While doing so I noticed that --exec-path takes a path just like these
options, so that option should be handled similarly as well.

Otherwise it makes sense.


Gábor


 Similarly, the completion only handles the stuck form --git-dir=path
 and not --git-dir path, so fix this as well.
 
 Signed-off-by: John Keeping j...@keeping.me.uk
 ---
  contrib/completion/git-completion.bash | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/contrib/completion/git-completion.bash 
 b/contrib/completion/git-completion.bash
 index 6c3bafe..8fbf941 100644
 --- a/contrib/completion/git-completion.bash
 +++ b/contrib/completion/git-completion.bash
 @@ -2492,9 +2492,10 @@ __git_main ()
   i=${words[c]}
   case $i in
   --git-dir=*) __git_dir=${i#--git-dir=} ;;
 + --git-dir)   ((c++)) ; __git_dir=${words[c]} ;;
   --bare)  __git_dir=. ;;
   --help) command=help; break ;;
 - -c) c=$((++c)) ;;
 + -c|--work-tree|--namespace) ((c++)) ;;
   -*) ;;
   *) command=$i; break ;;
   esac
 -- 
 1.8.3.1.676.gaae6535
 
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] completion: handle unstuck form of base git options

2013-06-22 Thread SZEDER Gábor
On Sat, Jun 22, 2013 at 02:30:33PM +0200, SZEDER Gábor wrote:
 Hi,
 
 On Sat, Jun 22, 2013 at 12:25:17PM +0100, John Keeping wrote:
  git-completion.bash's parsing of the command name relies on everything
  preceding it starting with '-' unless it is the -c option.  This
  allows users to use the stuck form of --work-tree=path and
  --namespace=path but not the unstuck forms --work-tree path and
  --namespace path.  Fix this.
 
 I never use these commands, so I looked up what --namespace means.
 While doing so I noticed that --exec-path takes a path just like these
 options, so that option should be handled similarly as well.

Never mind, I misunderstood the docs: --exec-path either takes a path
as --exec-path=path or it doesn't take one at all, but there is no
'--exec-path path'.


Gábor

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] user-manual: Update download size for Git and the kernel

2013-06-22 Thread W. Trevor King
On Tue, Jun 18, 2013 at 09:55:22PM -0400, W. Trevor King wrote:
 They've grown since d19fbc3 (Documentation: add git user's manual,
 2007-01-07) when the stats were initially added.  I've rounded
 download sizes up to the nearest power of ten MiB to decrease the
 precision and give a bit of growing room.  Exact sizes:

Oops, I meant “multiple of ten MiB” not “power of ten MiB” :p.  Not
that this wording is likely to cause major confusion ;).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature


Re: [PATCH 1/4] t9903: add tests for git-prompt pcmode

2013-06-22 Thread SZEDER Gábor
Hi,

On Thu, Jun 20, 2013 at 11:25:26PM -0300, Eduardo R. D'Avila wrote:
 git-prompt.sh lacks tests for PROMPT_COMMAND mode.
 
 Add tests for:
 * pcmode prompt without colors
 * pcmode prompt with colors for bash
 * pcmode prompt with colors for zsh
 
 Having these tests enables an upcoming refactor in
 a safe way.
 
 Signed-off-by: Eduardo R. D'Avila erdav...@gmail.com

I doubt the value of separate tests for zsh.  They might make sense as
long as there are different code paths for doing coloring for the two
shells, but after your refactorization in 2/4 there is only one common
block of if statements, which is already thoroughly excercised by your
tests for bash, making the separate tests for zsh redundant.


Gábor

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] git-prompt.sh: do not print duplicate clean color code

2013-06-22 Thread SZEDER Gábor
On Thu, Jun 20, 2013 at 11:25:28PM -0300, Eduardo R. D'Avila wrote:
 Do not print a duplicate clean color code when there
 is no other indicators other than the current branch
 in colored prompt.
 
 Signed-off-by: Eduardo R. D'Avila erdav...@gmail.com

Great.  I wanted to point out in the previous versions of this series
that the patch claiming to refactor coloring actually touches the test
script because it silently fixes the clean color code duplication.
Thanks for splitting that patch before I even managed to find the time
to mention it ;)

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] git-prompt.sh: add missing information in comments

2013-06-22 Thread SZEDER Gábor
On Thu, Jun 20, 2013 at 11:25:29PM -0300, Eduardo R. D'Avila wrote:
 Mention that the command below is needed for prompt
 in ZSH with PS1:
   setopt PROMPT_SUBST
 
 Make it clear that colored prompt is only available
 in PROMPT_COMMAND mode.
 
 Signed-off-by: Eduardo R. D'Avila erdav...@gmail.com
 ---
 5 4   contrib/completion/git-prompt.sh
  contrib/completion/git-prompt.sh | 9 +
  1 file changed, 5 insertions(+), 4 deletions(-)
 
 diff --git a/contrib/completion/git-prompt.sh 
 b/contrib/completion/git-prompt.sh
 index 70515cc..3ab2a69 100644
 --- a/contrib/completion/git-prompt.sh
 +++ b/contrib/completion/git-prompt.sh
 @@ -13,10 +13,10 @@
  #3a) Change your PS1 to call __git_ps1 as
  #command-substitution:
  #Bash: PS1='[\u@\h \W$(__git_ps1  (%s))]\$ '
 -#ZSH:  PS1='[%n@%m %c$(__git_ps1  (%s))]\$ '
 +#ZSH:  setopt PROMPT_SUBST ; PS1='[%n@%m %c$(__git_ps1  (%s))]\$ '
  #the optional argument will be used as format string.
 -#3b) Alternatively, if you are using bash, __git_ps1 can be
 -#used for PROMPT_COMMAND with two parameters, pre and
 +#3b) Alternatively, if you are using Bash or ZSH, __git_ps1 can
 +#be used for PROMPT_COMMAND with two parameters, pre and

The git-prompt script only supports bash and zsh, so that if you are
using Bash or ZSH part doesn't say much, does it?  Furthermore, zsh
doesn't have PROMPT_COMMAND but a similar facility.  So how about
something like this instead?

#3b) Alternatively, __git_ps1 can be used for PROMPT_COMMAND in
#Bash or for precmd in ZSH with two parameters, pre and


  #post, which are strings you would put in $PS1 before
  #and after the status string generated by the git-prompt
  #machinery.  e.g.
 @@ -78,7 +78,8 @@
  #
  # If you would like a colored hint about the current dirty state, set
  # GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on
 -# the colored output of git status -sb.
 +# the colored output of git status -sb and are available only when
 +# using __git_ps1 for PROMPT_COMMAND.

Likewise:

# using __git_ps1 for PROMPT_COMMAND or precmd.

  
  # __gitdir accepts 0 or 1 arguments (i.e., location)
  # returns location of .git repo
 -- 
 1.8.3.1.487.g28387b2
 
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] git-prompt.sh: refactor colored prompt code

2013-06-22 Thread Øystein Walle
Eduardo R. D'Avila erdavila at gmail.com writes:

 + local c_red='\[\e[31m\]'
 + local c_green='\[\e[32m\]'
 + local c_lblue='\[\e[1;34m\]'
 + local c_clear='\[\e[0m\]'
   fi
 - local c_red='\e[31m'
 - local c_green='\e[32m'
 - local c_lblue='\e[1;34m'
 - local c_clear='\e[0m'

I've gotten the impression it's better to use tput to generate the escape 
sequences instead of hardcoding them. So something like:

local c_red='\['$(tput setaf 1)'\]'
local c_green='\['$(tput setaf 2)'\]'
local c_green='\['$(tput setaf 4)'\]'
local c_clear='\['$(tput sgr0)'\]'

which is technically cleaner, if not visually.
 
The problem with that approach is that tput will be run several times for 
each prompt, so it would be best if the color variables were global. Another 
thing is that you rely on tput being available.

Øsse

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/4] doc/clone: Remove the '--bare -l -s' example

2013-06-22 Thread W. Trevor King
From: W. Trevor King wk...@tremily.us

There are other examples in git-clone.txt demonstrating both '--bare'
and '-l -s'.

Signed-off-by: W. Trevor King wk...@tremily.us
---
 Documentation/git-clone.txt | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 5c16e31..cec6fc1 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -271,13 +271,6 @@ $ git clone --bare -l /home/proj/.git /pub/scm/proj.git
 
 
 
-* Create a repository on the kernel.org machine that borrows from Linus:
-+
-
-$ git clone --bare -l -s /pub/scm/.../torvalds/linux-2.6.git \
-/pub/scm/.../me/subsys-2.6.git
-
-
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
1.8.3

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/4] doc/clone: Pick more compelling paths for the --reference example

2013-06-22 Thread W. Trevor King
From: W. Trevor King wk...@tremily.us

There may be times when using one of your local repositories as a
reference for a new clone make sense, but the implied version-bump in
the old example isn't one of them.  I think a more intuitive example
is multi-user system with a central reference clone, and the new paths
hint at this use case.

Signed-off-by: W. Trevor King wk...@tremily.us
---
 Documentation/git-clone.txt | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index cec6fc1..bf05ada 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -257,10 +257,10 @@ $ git show-branch
 * Clone from upstream while borrowing from an existing local directory:
 +
 
-$ git clone --reference my2.6 \
-   git://git.kernel.org/pub/scm/.../linux-2.7 \
-   my2.7
-$ cd my2.7
+$ git clone --reference /git/linux.git \
+   git://git.kernel.org/pub/scm/.../linux.git \
+   my-linux
+$ cd my-linux
 
 
 
-- 
1.8.3

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/4] Documentation: Update the NFS remote examples to use the staging repo

2013-06-22 Thread W. Trevor King
From: W. Trevor King wk...@tremily.us

linux-nfs.org seems to have restructured their repository layout since
8391c60 (git-remote.txt: fix example url, 2007-11-02), and Bruce's
repo is now at git://git.linux-nfs.org/projects/bfields/linux.git.
Bruce also has a more richer internal branch structure (master,
everything, for-3.1, ...), so updating the existing example to use his
current repo may be confusing.

To simplify, I've replaced the NFS repo with Greg's staging repo.
I've also updated the output of the surrounding commands to match the
output of a current run through.

Signed-off-by: W. Trevor King wk...@tremily.us
---
 Documentation/git-remote.txt  | 25 -
 Documentation/user-manual.txt | 26 --
 2 files changed, 32 insertions(+), 19 deletions(-)

diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 7a6f354..d007163 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -187,18 +187,25 @@ Examples
 $ git remote
 origin
 $ git branch -r
-origin/master
-$ git remote add linux-nfs git://linux-nfs.org/pub/linux/nfs-2.6.git
+  origin/HEAD - origin/master
+  origin/master
+$ git remote add staging git://git.kernel.org/.../gregkh/staging.git
 $ git remote
-linux-nfs
 origin
-$ git fetch
-* refs/remotes/linux-nfs/master: storing branch 'master' ...
-  commit: bf81b46
+staging
+$ git fetch staging
+...
+From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
+ * [new branch]  master - staging/master
+ * [new branch]  staging-linus - staging/staging-linus
+ * [new branch]  staging-next - staging/staging-next
 $ git branch -r
-origin/master
-linux-nfs/master
-$ git checkout -b nfs linux-nfs/master
+  origin/HEAD - origin/master
+  origin/master
+  staging/master
+  staging/staging-linus
+  staging/staging-next
+$ git checkout -b staging staging/master
 ...
 
 
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index e831cc2..4283d8f 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -431,19 +431,25 @@ You can also track branches from repositories other than 
the one you
 cloned from, using linkgit:git-remote[1]:
 
 -
-$ git remote add linux-nfs git://linux-nfs.org/pub/nfs-2.6.git
-$ git fetch linux-nfs
-* refs/remotes/linux-nfs/master: storing branch 'master' ...
-  commit: bf81b46
+$ git remote add staging git://git.kernel.org/.../gregkh/staging.git
+$ git fetch staging
+...
+From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
+ * [new branch]  master - staging/master
+ * [new branch]  staging-linus - staging/staging-linus
+ * [new branch]  staging-next - staging/staging-next
 -
 
 New remote-tracking branches will be stored under the shorthand name
-that you gave `git remote add`, in this case `linux-nfs`:
+that you gave `git remote add`, in this case `staging`:
 
 -
 $ git branch -r
-linux-nfs/master
-origin/master
+  origin/HEAD - origin/master
+  origin/master
+  staging/master
+  staging/staging-linus
+  staging/staging-next
 -
 
 If you run `git fetch remote` later, the remote-tracking branches
@@ -455,9 +461,9 @@ a new stanza:
 -
 $ cat .git/config
 ...
-[remote linux-nfs]
-   url = git://linux-nfs.org/pub/nfs-2.6.git
-   fetch = +refs/heads/*:refs/remotes/linux-nfs/*
+[remote staging]
+   url = git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
+   fetch = +refs/heads/*:refs/remotes/staging/*
 ...
 -
 
-- 
1.8.3

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/4] Documentation: Update 'linux-2.6.git' - 'linux.git'

2013-06-22 Thread W. Trevor King
From: W. Trevor King wk...@tremily.us

The 3.x tree has been out for a while now.  The -2.6 repository name
survived the initial release [1], but kernel.org now only lists
'linux.git' (for aegl as well as torvalds) [2].

[1]: http://article.gmane.org/gmane.linux.kernel/1147422
  On 2011-05-30 01:47:57 GMT, Linus Torvalds wrote:
   ... yes, that means that my git tree is still called
   linux-2.6.git on kernel.org.
[2]: http://git.kernel.org/cgit/

Signed-off-by: W. Trevor King wk...@tremily.us
---
 Documentation/git-clone.txt  | 4 ++--
 Documentation/git-fast-export.txt| 2 +-
 Documentation/technical/racy-git.txt | 6 +++---
 Documentation/user-manual.txt| 8 
 t/perf/README| 2 +-
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index bf05ada..98b139c 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -239,8 +239,8 @@ Examples
 * Clone from upstream:
 +
 
-$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6
-$ cd my2.6
+$ git clone git://git.kernel.org/pub/scm/.../linux.git my-linux
+$ cd my-linux
 $ make
 
 
diff --git a/Documentation/git-fast-export.txt 
b/Documentation/git-fast-export.txt
index d6487e1..0314da3 100644
--- a/Documentation/git-fast-export.txt
+++ b/Documentation/git-fast-export.txt
@@ -137,7 +137,7 @@ Limitations
 ---
 
 Since 'git fast-import' cannot tag trees, you will not be
-able to export the linux-2.6.git repository completely, as it contains
+able to export the linux.git repository completely, as it contains
 a tag referencing a tree instead of a commit.
 
 GIT
diff --git a/Documentation/technical/racy-git.txt 
b/Documentation/technical/racy-git.txt
index 6dc82ca..f716d6d 100644
--- a/Documentation/technical/racy-git.txt
+++ b/Documentation/technical/racy-git.txt
@@ -135,9 +135,9 @@ them, and give the same timestamp to the index file:
   $ git ls-files | git update-index --stdin
   $ touch -r .datestamp .git/index
 
-This will make all index entries racily clean.  The linux-2.6
-project, for example, there are over 20,000 files in the working
-tree.  On my Athlon 64 X2 3800+, after the above:
+This will make all index entries racily clean.  The linux project, for
+example, there are over 20,000 files in the working tree.  On my
+Athlon 64 X2 3800+, after the above:
 
   $ /usr/bin/time git diff-files
   1.68user 0.54system 0:02.22elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index 4283d8f..a13de93 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -66,8 +66,8 @@ $ git clone 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
 The initial clone may be time-consuming for a large project, but you
 will only need to clone once.
 
-The clone command creates a new directory named after the project (`git`
-or `linux-2.6` in the examples above).  After you cd into this
+The clone command creates a new directory named after the project
+(`git` or `linux` in the examples above).  After you cd into this
 directory, you will see that it contains a copy of the project files,
 called the def_working_tree,working tree, together with a special
 top-level directory named `.git`, which contains all the information
@@ -2162,7 +2162,7 @@ To set this up, first create your work tree by cloning 
Linus's public
 tree:
 
 -
-$ git clone 
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git work
+$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
work
 $ cd work
 -
 
@@ -2204,7 +2204,7 @@ make it easy to push both branches to your public tree.  
(See
 -
 $ cat  .git/config EOF
 [remote mytree]
-   url =  master.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
+   url =  master.kernel.org:/pub/scm/linux/kernel/git/aegl/linux.git
push = release
push = test
 EOF
diff --git a/t/perf/README b/t/perf/README
index c552f56..8848c14 100644
--- a/t/perf/README
+++ b/t/perf/README
@@ -66,7 +66,7 @@ You can set the following variables (also in your config.mak):
 GIT_PERF_LARGE_REPO
Repositories to copy for the performance tests.  The normal
repo should be at least git.git size.  The large repo should
-   probably be about linux-2.6.git size for optimal results.
+   probably be about linux.git size for optimal results.
Both default to the git.git you are running from.
 
 You can also pass the options taken by ordinary git tests; the most
-- 
1.8.3

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/4] Update linux-2.6.git location and related examples

2013-06-22 Thread W. Trevor King
From: W. Trevor King wk...@tremily.us

David and Junio mentioned that I'd missed a few 2.6 references in my
initial pass.  Here's a second attempt that does some deeper reworking
of the effected sections.  Each deeper rewrite gets its own patch and
motivation, with the final patch making all the superficial changes
that were not fixed in the earlier patches.

I've dropped the download size update (2/2 in v1), which Junio has
queued separately.  I also rebased the series on maint-1.8.2, since
that's where the size update landed.  I only touch low-churn areas
though, so this series should apply to any recent branch.

W. Trevor King (4):
  doc/clone: Remove the '--bare -l -s' example
  doc/clone: Pick more compelling paths for the --reference example
  Documentation: Update the NFS remote examples to use the staging repo
  Documentation: Update 'linux-2.6.git' - 'linux.git'

 Documentation/git-clone.txt  | 19 ++-
 Documentation/git-fast-export.txt|  2 +-
 Documentation/git-remote.txt | 25 -
 Documentation/technical/racy-git.txt |  6 +++---
 Documentation/user-manual.txt| 34 --
 t/perf/README|  2 +-
 6 files changed, 47 insertions(+), 41 deletions(-)

-- 
1.8.3

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] t9903: add tests for git-prompt pcmode

2013-06-22 Thread Eduardo D'Avila
2013/6/22 SZEDER Gábor sze...@ira.uka.de:
 On Thu, Jun 20, 2013 at 11:25:26PM -0300, Eduardo R. D'Avila wrote:
 git-prompt.sh lacks tests for PROMPT_COMMAND mode.

 Add tests for:
 * pcmode prompt without colors
 * pcmode prompt with colors for bash
 * pcmode prompt with colors for zsh

 Having these tests enables an upcoming refactor in
 a safe way.

 Signed-off-by: Eduardo R. D'Avila erdav...@gmail.com

 I doubt the value of separate tests for zsh.  They might make sense as
 long as there are different code paths for doing coloring for the two
 shells, but after your refactorization in 2/4 there is only one common
 block of if statements, which is already thoroughly excercised by your
 tests for bash, making the separate tests for zsh redundant.

These tests where important to make sure that I wouldn't break anything during
the refactorization. Having them pass before *and* after refactorization
guarantees that nothing was broken (except for some subtle case that might have
not be included in the tests).

However, I agree that they became redundant.

Would it make sense to include a patch that only removes the zsh
tests, after the
refactorization? I'm considering that *1* simple zsh test must be kept during
this removal, to make sure the code path for zsh is run.


Eduardo
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] git-prompt.sh: refactor colored prompt code

2013-06-22 Thread Eduardo D'Avila
2013/6/22 Øystein Walle oys...@gmail.com:
 I've gotten the impression it's better to use tput to generate the escape
 sequences instead of hardcoding them. So something like:

 local c_red='\['$(tput setaf 1)'\]'
 local c_green='\['$(tput setaf 2)'\]'
 local c_green='\['$(tput setaf 4)'\]'
 local c_clear='\['$(tput sgr0)'\]'

 which is technically cleaner, if not visually.

 The problem with that approach is that tput will be run several times for
 each prompt, so it would be best if the color variables were global. Another
 thing is that you rely on tput being available.

Are there any guidelines regarding global shell script variables?

I'm considering doing this:
   __git_c_red=\[$(tput setaf 1 || echo -e '\e[31m')\]
which handles the case where tput is not available.


Eduardo
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] git-daemon: have --no-syslog

2013-06-22 Thread Andreas Krey
Some people run inetds that collect stderr of the spawned programs.
Give them 'git-daemon --inetd --no-syslog' to keep error output
on stderr.

Signed-off-by: Andreas Krey a.k...@gmx.de
---
 Documentation/git-daemon.txt |  4 
 daemon.c | 14 +++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 223f731..007d3fc 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -113,6 +113,10 @@ OPTIONS
Log to syslog instead of stderr. Note that this option does not imply
--verbose, thus by default only error conditions will be logged.
 
+--no-syslog::
+   Disable the implicit --syslog of --inetd and --deatch, thus keeping
+   error output on stderr.
+
 --user-path::
 --user-path=path::
Allow {tilde}user notation to be used in requests.  When
diff --git a/daemon.c b/daemon.c
index 6aeddcb..2f5d5bf 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1196,7 +1196,6 @@ int main(int argc, char **argv)
}
if (!strcmp(arg, --inetd)) {
inetd_mode = 1;
-   log_syslog = 1;
continue;
}
if (!strcmp(arg, --verbose)) {
@@ -1207,6 +1206,10 @@ int main(int argc, char **argv)
log_syslog = 1;
continue;
}
+   if (!strcmp(arg, --no-syslog)) {
+   log_syslog = -1;
+   continue;
+   }
if (!strcmp(arg, --export-all)) {
export_all_trees = 1;
continue;
@@ -1263,7 +1266,6 @@ int main(int argc, char **argv)
}
if (!strcmp(arg, --detach)) {
detach = 1;
-   log_syslog = 1;
continue;
}
if (!prefixcmp(arg, --user=)) {
@@ -1309,6 +1311,12 @@ int main(int argc, char **argv)
usage(daemon_usage);
}
 
+   if ((inetd_mode || detach)  log_syslog == 0)
+   log_syslog = 1;
+
+   if (log_syslog == -1)
+   log_syslog = 0;
+
if (log_syslog) {
openlog(git-daemon, LOG_PID, LOG_DAEMON);
set_die_routine(daemon_die);
@@ -1337,7 +1345,7 @@ int main(int argc, char **argv)
die(base-path '%s' does not exist or is not a directory,
base_path);
 
-   if (inetd_mode) {
+   if (inetd_mode  log_syslog) {
if (!freopen(/dev/null, w, stderr))
die_errno(failed to redirect stderr to /dev/null);
}
-- 
1.8.3.1.485.g9704416.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Is there a hook that runs on git reset?

2013-06-22 Thread André Hänsel
I am using a script that runs as post-checkout and post-merge hook to ensure
some permissions on the working copy files.

Neither of these hooks is run on git reset, so after a git reset --hard the
permissions are lost because apparently the files were created freshly. I
guess I would have expected post-checkout to run.

Is there a hook that runs on git reset that I can use to run my permissions
script?


--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 04/16] t/t5505-remote: remove dependency on $origin_url

2013-06-22 Thread Junio C Hamano
Ramkumar Ramachandra artag...@gmail.com writes:

 Junio C Hamano wrote:
 Is there a reason why quux is better than another randomly chosen
 string $(pwd)/one?

 $(pwd)/one is not randomly chosen: that configuration will work with
 push/pull, and is therefore misleading.

But isn't the URL: field in remotes file meant to be usable with
push and pull?  Why is it misleading to put a value that is more
plausible (I believe 'one' in the current directory is another
repository and the intent is that the old .git/remotes/origin setup
lets you fetch from and push to that repository) there?

I do not think you are creating a quux repository to be pushed into
and fetched from with this change. Placing 'quux' in the URL: field
feels a lot more misleading to me.  What am I missing?
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


git subtree pull incorrectly reports merge conflict

2013-06-22 Thread Eric Lindsey
I'm having trouble pulling changes from a repo that was imported as a
subtree with 'git subtree add'. The issue occurs when I have
previously used 'git subtree push' from within the project directory,
then pushed changes to the remote repo again from somewhere else (from
another project also using it as a subtree, or directly with 'git
push' -- doesn't matter). When I go back to the initial project, 'git
subtree pull' has a merge conflict, and fails to merge the new
changes. The reported conflict is half-empty, so I can't see why there
is any conflict at all.

I've found an odd workaround, where calling subtree pull immediately
after the subtree push from the project directory seems to keep
things in sync and prevent the later conflict (see the script below).
I'm stumped as to why running a pull should find any changes right
after a push, but this is what happens. So it seems like a bug, unless
I'm missing a critical step somewhere -- I'm fairly new to git still.

I've pasted a script below that reproduces the problem in a simple
case, for my version of git (1.8.3.1, installed via homebrew on OS X
10.8.4).

Thanks,
Eric


#start from scratch
rm -rf foo bar foo.git

# create remote repo. for foo (bare)
mkdir foo.git
cd foo.git
git init --bare
cd ..

#create library foo and push to remote repo
mkdir foo
cd foo
echo this is a test file  test.foo
git init
git add .
git commit -m initial commit to foo
git remote add origin ../foo.git
git push origin master
cd ..

#create a project that uses foo as subtree
mkdir bar
cd bar
git init
echo test  test.bar
git add .
git commit -m initial commit to bar
git subtree add --prefix=foo ../foo.git master
echo modify foo from bar  foo/test.foo
git add foo/test.foo
git commit -m update foo from bar
git subtree push --prefix=foo ../foo.git master
### if I uncomment the next line, final 'subtree pull' doesn't fail... why?
#git subtree pull --prefix=foo ../foo.git master -m pull right after push
cd ..

#now update foo from elsewhere
cd foo
git pull origin master
echo modify foo from foo  test.foo
git add test.foo
git commit -m update foo again
git push origin master
cd ..

# try to pull update from project bar
cd bar
git subtree pull --prefix=foo ../foo.git master -m pull foo

#above command fails to merge, and the reported conflict is half-empty.
#resulting contents of bar/foo/test.foo are:

#this is a test file
#modify foo from bar
# HEAD
#===
#modify foo from foo
# f0a24eeb1614228a1368ae23112ff4923dcf557e
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: fast-import bug?

2013-06-22 Thread Dave Abrahams

on Sat Jun 22 2013, John Keeping john-AT-keeping.me.uk wrote:

 On Fri, Jun 21, 2013 at 02:21:47AM -0700, Dave Abrahams wrote:
 The docs for fast-import seem to imply that I can use ls to get the
 SHA1 of a commit for which I have a mark:
 
Reading from a named tree
The dataref can be a mark reference (:idnum) or the full 
 40-byte

SHA-1 of a Git tag, commit, or tree object, preexisting or 
 waiting to
be written. The path is relative to the top level of the tree 
 named by
dataref.
 
'ls' SP dataref SP path LF
 
See filemodify above for a detailed description of path.
 
Output uses the same format as git ls-tree tree -- path:
 
mode SP ('blob' | 'tree' | 'commit') SP dataref HT path LF
 
The dataref represents the blob, tree, or commit object at path 
 and
^^
can be used in later cat-blob, filemodify, or ls commands.
 
 but I can't get it to work.  It's not entirely clear it's supposed to
 work.  What path would I pass?  Passing an empty path simply causes git
 to report missing .

 Which version of Git are you using?  

,[ git --version ]
| git version 1.8.3.1
`

 I just tried this and get the error
 fatal: Empty path component found in input, 

I get that too.

 which seems to be from commit 178e1de (fast-import: don't allow 'ls'
 of path with empty components, 2012-03-09), which is included in Git
 1.7.9.5.

Yes, that's at least part of the issue.  I notice git-fast-import
rejects the root path  for other commands, e.g. when used as the
source of a filecopy we get the same issue.  I also note that the docs
don't make it clear that quoting the path is mandatory if it might turn
out to be empty.

 It seems to be slightly more complicated than that though, because after
 allowing empty trees I get the missing message for the root tree.

Yeah, I've tried to patch Git to solve this but ran into that problem
and gave up.

 This seems to be because its mode is 0 and not S_IFDIR.

Aha.

 With the patch below, things are working as I expect 

Awesome; works for me, too!

 but I don't understand why the mode of the root is not set correctly
 at this point.  Perhaps someone more familiar with fast-import will
 have some insight...

Yeah... there's no bug tracker for Git, right?  So if nobody pays
attention to this thread, the problem will persist?

 -- 8 --
 diff --git a/fast-import.c b/fast-import.c
 index 23f625f..bcce651 100644
 --- a/fast-import.c
 +++ b/fast-import.c
 @@ -1626,6 +1626,15 @@ del_entry:
   return 1;
  }

 +static void copy_tree_entry(struct tree_entry *dst, struct tree_entry *src)
 +{
 + memcpy(dst, src, sizeof(*dst));
 + if (src-tree  is_null_sha1(src-versions[1].sha1))
 + dst-tree = dup_tree_content(src-tree);
 + else
 + dst-tree = NULL;
 +}
 +
  static int tree_content_get(
   struct tree_entry *root,
   const char *p,
 @@ -1651,11 +1660,7 @@ static int tree_content_get(
   e = t-entries[i];
   if (e-name-str_len == n  !strncmp_icase(p, 
 e-name-str_dat, n)) {
   if (!slash1) {
 - memcpy(leaf, e, sizeof(*leaf));
 - if (e-tree  
 is_null_sha1(e-versions[1].sha1))
 - leaf-tree = dup_tree_content(e-tree);
 - else
 - leaf-tree = NULL;
 + copy_tree_entry(leaf, e);
   return 1;
   }
   if (!S_ISDIR(e-versions[1].mode))
 @@ -3065,7 +3070,11 @@ static void parse_ls(struct branch *b)
   die(Garbage after path in: %s, command_buf.buf);
   p = uq.buf;
   }
 - tree_content_get(root, p, leaf);
 + if (!*p) {
 + copy_tree_entry(leaf, root);
 + leaf.versions[1].mode = S_IFDIR;
 + } else
 + tree_content_get(root, p, leaf);
   /*
* A directory in preparation would have a sha1 of zero
* until it is saved.  Save, for simplicity.

-- 
Dave Abrahams
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html