* Re: [HELP] A local branch has disappeared
From: Neil Macneale @ 2009-01-19 5:37 UTC (permalink / raw)
To: Johnny Lee; +Cc: git
In-Reply-To: <488807870901181954p558756f5v94c8a6681125e8bb@mail.gmail.com>
On Jan 18, 2009, at 7:54 PM, Johnny Lee wrote:
> Hi all,
>
> Today I found my current branch (named cupcake) has disappeared.
> git@tomato:~/golf$ git branch -a
> htc_cupcake
> tmo_cupcake
> origin/HEAD
> origin/cupcake
> origin/device
>
> As you can see, there is no "*" to mark the current branch.
>
> But when I check the HEAD, it still pointed to the cupcake branch
> git@tomato:~/golf$ cat .git/HEAD
> ref: refs/heads/cupcake
>
> But when I check the ref/heads, the cupcake is missing
> git@tomato:~/golf$ ls .git/refs/heads/
> htc_cupcake tmo_cupcake
>
> And the cupcake in still in the config:
> git@tomato:~/golf$ cat .git/config
> [core]
> repositoryformatversion = 0
> filemode = true
> bare = false
> logallrefupdates = true
> sharedRepository = 1
> [remote "origin"]
> url = /home/rick/golfresort/device/.git
> fetch = +refs/heads/*:refs/remotes/origin/*
> [branch "cupcake"]
> remote = origin
> merge = refs/heads/cupcake
>
> I'm confused:
> 1. I didn't do any aggressive operations. Why the branch has
> disappeared? Normally I have done these operation for this repo:
> i. pull from parent repo
> ii. cloned by children repo
> iii. pulled by children repo
> iv. pushed from children repo
> 2. Is there any way to resume the cupcake branch? Can I manually add
> the cupcake to ref/heads?
I don't know why the cupcake branch would be gone, but you can
probably get something from the logs:
$ cat .git/logs/refs/heads/cupcake
The last line should tell you what commit you were at before it was
destroyed. Then you can create the branch again.
$ git checkout -b cupcake <hash in the log>
Hope that helps,
Neil
^ permalink raw reply
* [PATCH (resend) 2/2] difftool: put the cursor on the editable file for Vim
From: David Aguilar @ 2009-01-19 5:34 UTC (permalink / raw)
To: git; +Cc: gitster, David Aguilar
You only need to edit worktree files when comparing against
the worktree. Put the cursor automatically into its window for
vimdiff and gvimdiff to avoid doing <C-w>l every time.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
contrib/difftool/git-difftool-helper | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
index 0b266e3..a6f862f 100755
--- a/contrib/difftool/git-difftool-helper
+++ b/contrib/difftool/git-difftool-helper
@@ -78,12 +78,16 @@ launch_merge_tool () {
"$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
;;
- meld|vimdiff)
+ meld)
"$merge_tool_path" "$LOCAL" "$REMOTE"
;;
+ vimdiff)
+ "$merge_tool_path" -c "wincmd l" "$LOCAL" "$REMOTE"
+ ;;
+
gvimdiff)
- "$merge_tool_path" -f "$LOCAL" "$REMOTE"
+ "$merge_tool_path" -c "wincmd l" -f "$LOCAL" "$REMOTE"
;;
xxdiff)
--
1.6.1.149.g7bbd8
^ permalink raw reply related
* Re: [PATCH] contrib: add 'git difftool' for launching common merge tools
From: David Aguilar @ 2009-01-19 5:32 UTC (permalink / raw)
To: markus.heidelberg; +Cc: Git mailing list
In-Reply-To: <200901190603.06506.markus.heidelberg@web.de>
On Sun, Jan 18, 2009 at 9:03 PM, Markus Heidelberg
> Well, in "wincmd l" "l" doesn't mean "left", it doesn't mean "put the
> cursor into the left window", it just moves the cursor into the next
> right window. So "wincmd r" doesn't mean "put the cursor into the right
> window", but "rotate the window" (see :help ctrl-w_r).
oops.. i should know better. sorry... let's ignore 2/2 for now then.
I'll resend. duh.. I should have known better.. h left, j down, k up, l right.
>
> So with "wincmd r" the local file would be moved to the left side and
> the index file to the right side, still containing the cursor. Not what
> we want.
>
> With "wincmd l" the local file would stay on the right side, the index
> file on the left side, but the cursor would move from the left to the
> right side. Now we can edit the local file.
>
>> > You have deleted all the '-' chars from git-command, but when using it as the
>> > name I think it's the preferred method, only when used as command then without
>> > slash.
>>
>> I was wondering about that. I think I tried to follow the lead from
>> the git-diff.txt documentation, but "diff" is a builtin and thus
>> doesn't have an actual git-diff, so I see why they should be
>> different.
>
> Hmm, I don't think it makes a difference, whether it's a builtin or not.
> git-diff only exists behind the scenes, invoking it as "git-diff"
> doesn't work anymore with default settings. On the other hand, I can
> also invoke "git difftool" without the slash, git can find it. The same
> way I can for example call "git svn", which also isn't a builtin.
>
> Markus
>
>
--
David
^ permalink raw reply
* [PATCH 2/2] difftool: put the cursor on the editable file for Vim
From: David Aguilar @ 2009-01-19 5:27 UTC (permalink / raw)
To: git; +Cc: gitster, David Aguilar
In-Reply-To: <1232342840-27459-1-git-send-email-davvid@gmail.com>
You only need to edit worktree files when comparing against
the worktree. Put the cursor automatically into its window for
vimdiff and gvimdiff to avoid doing <C-w>r every time.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
contrib/difftool/git-difftool-helper | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
index 0b266e3..a6f862f 100755
--- a/contrib/difftool/git-difftool-helper
+++ b/contrib/difftool/git-difftool-helper
@@ -78,12 +78,16 @@ launch_merge_tool () {
"$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
;;
- meld|vimdiff)
+ meld)
"$merge_tool_path" "$LOCAL" "$REMOTE"
;;
+ vimdiff)
+ "$merge_tool_path" -c "wincmd r" "$LOCAL" "$REMOTE"
+ ;;
+
gvimdiff)
- "$merge_tool_path" -f "$LOCAL" "$REMOTE"
+ "$merge_tool_path" -c "wincmd r" -f "$LOCAL" "$REMOTE"
;;
xxdiff)
--
1.6.1.149.g7bbd8
^ permalink raw reply related
* [PATCH 1/2] difftool: fix documentation problems
From: David Aguilar @ 2009-01-19 5:27 UTC (permalink / raw)
To: git; +Cc: gitster, David Aguilar
This patch makes the difftool docs always refer to the
git-difftool script using the dashed form of the name.
Only command examples use the non-dashed form now.
Signed-off-by: David Aguilar <davvid@gmail.com>
---
contrib/difftool/git-difftool | 5 ++---
contrib/difftool/git-difftool.txt | 20 ++++++++++----------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/contrib/difftool/git-difftool b/contrib/difftool/git-difftool
index 1fc087c..0cda3d2 100755
--- a/contrib/difftool/git-difftool
+++ b/contrib/difftool/git-difftool
@@ -4,7 +4,7 @@
# This is a wrapper around the GIT_EXTERNAL_DIFF-compatible
# git-difftool-helper script. This script exports
# GIT_EXTERNAL_DIFF and GIT_PAGER for use by git, and
-# GIT_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
+# GIT_DIFFTOOL_NO_PROMPT and GIT_MERGE_TOOL for use by git-difftool-helper.
# Any arguments that are unknown to this script are forwarded to 'git diff'.
use strict;
@@ -18,8 +18,7 @@ my $DIR = abs_path(dirname($0));
sub usage
{
print << 'USAGE';
-
-usage: git difftool [--no-prompt] [--tool=tool] ["git diff" options]
+usage: git difftool [--tool=<tool>] [--no-prompt] ["git diff" options]
USAGE
exit 1;
}
diff --git a/contrib/difftool/git-difftool.txt b/contrib/difftool/git-difftool.txt
index 3940c70..ca3dbd2 100644
--- a/contrib/difftool/git-difftool.txt
+++ b/contrib/difftool/git-difftool.txt
@@ -11,16 +11,16 @@ SYNOPSIS
DESCRIPTION
-----------
-'git difftool' is a git command that allows you to compare and edit files
+'git-difftool' is a git command that allows you to compare and edit files
between revisions using common merge tools. At its most basic level,
-'git difftool' does what 'git mergetool' does but its use is for non-merge
+'git-difftool' does what 'git-mergetool' does but its use is for non-merge
situations such as when preparing commits or comparing changes against
the index.
'git difftool' is a frontend to 'git diff' and accepts the same
arguments and options.
-See linkgit:git-diff[7] for the full list of supported options.
+See linkgit:git-diff[1] for the full list of supported options.
OPTIONS
-------
@@ -30,7 +30,7 @@ OPTIONS
Valid merge tools are:
kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge, and opendiff
+
-If a merge resolution program is not specified, 'git difftool'
+If a merge resolution program is not specified, 'git-difftool'
will use the configuration variable `merge.tool`. If the
configuration variable `merge.tool` is not set, 'git difftool'
will pick a suitable default.
@@ -38,15 +38,15 @@ will pick a suitable default.
You can explicitly provide a full path to the tool by setting the
configuration variable `mergetool.<tool>.path`. For example, you
can configure the absolute path to kdiff3 by setting
-`mergetool.kdiff3.path`. Otherwise, 'git difftool' assumes the
+`mergetool.kdiff3.path`. Otherwise, 'git-difftool' assumes the
tool is available in PATH.
+
Instead of running one of the known merge tool programs,
-'git difftool' can be customized to run an alternative program
+'git-difftool' can be customized to run an alternative program
by specifying the command line to invoke in a configuration
variable `mergetool.<tool>.cmd`.
+
-When 'git difftool' is invoked with this tool (either through the
+When 'git-difftool' is invoked with this tool (either through the
`-t` or `--tool` option or the `merge.tool` configuration variable)
the configured command line will be invoked with the following
variables available: `$LOCAL` is set to the name of the temporary
@@ -56,7 +56,7 @@ of the diff post-image. `$BASE` is provided for compatibility
with custom merge tool commands and has the same value as `$LOCAL`.
--no-prompt::
- Do not prompt before launching a merge tool.
+ Do not prompt before launching a diff tool.
CONFIG VARIABLES
----------------
@@ -81,13 +81,13 @@ See the `--tool=<tool>` option above for more details.
SEE ALSO
--------
-linkgit:git-diff[7]::
+linkgit:git-diff[1]::
Show changes between commits, commit and working tree, etc
linkgit:git-mergetool[1]::
Run merge conflict resolution tools to resolve merge conflicts
-linkgit:git-config[7]::
+linkgit:git-config[1]::
Get and set repository or global options
--
1.6.1.149.g7bbd8
^ permalink raw reply related
* Re: [PATCH] contrib: add 'git difftool' for launching common merge tools
From: Markus Heidelberg @ 2009-01-19 5:03 UTC (permalink / raw)
To: David Aguilar; +Cc: Git mailing list
In-Reply-To: <402731c90901181634u32b39c87t6e88d9efef0d3485@mail.gmail.com>
David Aguilar, 19.01.2009:
> On Sun, Jan 18, 2009 at 11:25 AM, Markus Heidelberg
> <markus.heidelberg@web.de> wrote:
> > David Aguilar, 16.01.2009:
> >> + meld|vimdiff)
> >> + "$merge_tool_path" "$LOCAL" "$REMOTE"
> >> + ;;
> >> +
> >> + gvimdiff)
> >> + "$merge_tool_path" -f "$LOCAL" "$REMOTE"
> >> + ;;
> >
> > Maybe use '-c "wincmd l"' for Vim as in my patch for git-mergetool to
> > automatically place the cursor in the editable file? Useful for editing,
> > if git-difftool is used to diff a file from the working tree.
> >
> > See http://thread.gmane.org/gmane.comp.version-control.git/106109
>
>
> Very cool. When you have unstaged changes git diff sends the local
> filename as the 2nd argument so I changed the vim command to "wincmd
> r" so that vim places the cursor on the right hand side.
Well, in "wincmd l" "l" doesn't mean "left", it doesn't mean "put the
cursor into the left window", it just moves the cursor into the next
right window. So "wincmd r" doesn't mean "put the cursor into the right
window", but "rotate the window" (see :help ctrl-w_r).
So with "wincmd r" the local file would be moved to the left side and
the index file to the right side, still containing the cursor. Not what
we want.
With "wincmd l" the local file would stay on the right side, the index
file on the left side, but the cursor would move from the left to the
right side. Now we can edit the local file.
> > You have deleted all the '-' chars from git-command, but when using it as the
> > name I think it's the preferred method, only when used as command then without
> > slash.
>
> I was wondering about that. I think I tried to follow the lead from
> the git-diff.txt documentation, but "diff" is a builtin and thus
> doesn't have an actual git-diff, so I see why they should be
> different.
Hmm, I don't think it makes a difference, whether it's a builtin or not.
git-diff only exists behind the scenes, invoking it as "git-diff"
doesn't work anymore with default settings. On the other hand, I can
also invoke "git difftool" without the slash, git can find it. The same
way I can for example call "git svn", which also isn't a builtin.
Markus
^ permalink raw reply
* Re: [PATCH v2] contrib: add 'git-difftool' for launching common diff tools
From: Markus Heidelberg @ 2009-01-19 4:45 UTC (permalink / raw)
To: David Aguilar; +Cc: git, gitster
In-Reply-To: <1232324753-16137-1-git-send-email-davvid@gmail.com>
David Aguilar, 19.01.2009:
> 'git-difftool' is a git command that allows you to compare and edit files
> between revisions using common merge tools. 'git-difftool' does what
> 'git-mergetool' does but its use is for non-merge situations such as
> when preparing commits or comparing changes against the index.
> It uses the same configuration variables as 'git-mergetool' and
> provides the same command-line interface as 'git-diff'.
>
> Signed-off-by: David Aguilar <davvid@gmail.com>
> ---
>
> This newer version addresses the feedback from Markus Heidelberg.
> difftool is now more consistent with mergetool and it includes
> Markus's vimdiff enhancements for positioning the cursor at startup.
Your patch is already in master, you should send a patch against it.
Markus
^ permalink raw reply
* Re: git-patches list?
From: Johannes Schindelin @ 2009-01-19 4:29 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Junio C Hamano, Akira Kitada, git
In-Reply-To: <alpine.DEB.1.00.0901131158500.3586@pacific.mpi-cbg.de>
Hi,
On Tue, 13 Jan 2009, Johannes Schindelin wrote:
> http://gitrss.q42.co.uk/
>
> I am sure that Julian can be convinced to filter "[PATCH", too.
And he was nice enough to add a few more filters.
Ciao,
Dscho
^ permalink raw reply
* git-svn updates
From: Eric Wong @ 2009-01-19 4:06 UTC (permalink / raw)
To: git
Hi all,
I've acked a few patches and pushed out several fixes of my own to
git://git.bogomips.org/git-svn.git
They should be reasonably safe to run, but I haven't been doing much
hacking in recent months so I may be a bit rusty. Extra eyes and
testing would be very much appreciated.
Eric Wong (4):
git-svn: handle empty files marked as symlinks in SVN
git-svn: better attempt to handle broken symlink updates
git-svn: fix SVN 1.1.x compatibility
git-svn: avoid importing nested git repos
Marcel Koeppen (1):
git-svn: Show UUID in svn info for added directories with svn 1.5.5
Pete Harlan (1):
git-svn: Add --localtime option to "fetch"
I'll try to get to splitting out the monster git-svn.perl file by next
weekend.
I also got a private bug report about EDITOR/VISUAL usage with `git svn
dcommit -e' when there was a space in the command. Perhaps introducing
a Git::Editor Perl module that emulates editor.c would be a start?
--
Eric Wong
^ permalink raw reply
* [HELP] A local branch has disappeared
From: Johnny Lee @ 2009-01-19 3:54 UTC (permalink / raw)
To: git
Hi all,
Today I found my current branch (named cupcake) has disappeared.
git@tomato:~/golf$ git branch -a
htc_cupcake
tmo_cupcake
origin/HEAD
origin/cupcake
origin/device
As you can see, there is no "*" to mark the current branch.
But when I check the HEAD, it still pointed to the cupcake branch
git@tomato:~/golf$ cat .git/HEAD
ref: refs/heads/cupcake
But when I check the ref/heads, the cupcake is missing
git@tomato:~/golf$ ls .git/refs/heads/
htc_cupcake tmo_cupcake
And the cupcake in still in the config:
git@tomato:~/golf$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sharedRepository = 1
[remote "origin"]
url = /home/rick/golfresort/device/.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "cupcake"]
remote = origin
merge = refs/heads/cupcake
I'm confused:
1. I didn't do any aggressive operations. Why the branch has
disappeared? Normally I have done these operation for this repo:
i. pull from parent repo
ii. cloned by children repo
iii. pulled by children repo
iv. pushed from children repo
2. Is there any way to resume the cupcake branch? Can I manually add
the cupcake to ref/heads?
Thanks very much for your considerations,
Johnny
--
we all have our crosses to bear
^ permalink raw reply
* Re: [PATCH/RFC v1 1/1] bug fix, diff whitespace ignore options
From: Johannes Schindelin @ 2009-01-19 3:53 UTC (permalink / raw)
To: Keith Cascio; +Cc: git, Junio C Hamano
In-Reply-To: <alpine.GSO.2.00.0901181754190.9333@kiwi.cs.ucla.edu>
Hi,
On Sun, 18 Jan 2009, Keith Cascio wrote:
> Fixed bug in diff whitespace ignore options.
> It is now OK to specify more than one whitespace ignore option
> on the command line. In unit test 4015, expect success rather
> than failure for 4 cases.
> Note: I do not fully understand why this fix works, but it passes
> all 68 t4???-* diff test scripts.
>
> The semantics of the three whitespace ignore flags
> { -w, -b, --ignore-space-at-eol }
> obey a relation of transitive implication, i.e. the stronger
> options imply the weaker options:
> -w implies the other two
> -b implies --ignore-space-at-eol
> --ignore-space-at-eol implies only itself
>
> Therefore it is never necessary to specify more than one of these
> on the command line. Yet we imagine scenarios where software
> wrappers (e.g. GUIs, etc) generate command lines that switch on
> more than one of these flags simultaneously. It is unreasonable
> to prohibit specifying more than one, since a new user might not
> immediately discern the implication relation. Now we call such
> a command line valid and legal.
>
> Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
> ---
This does not really look all that similar to other commit messages.
For example, "Note: I do not fully understand why this fix works, but it
passes all 68 t4???-* diff test scripts." is rather discouraging. If you
are not convinced, how should we be?
However, I almost can excuse that, but...
> t/t4015-diff-whitespace.sh | 8 ++++----
> xdiff/xutils.c | 22 ++++++++++++----------
> 2 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/xdiff/xutils.c b/xdiff/xutils.c
> index d7974d1..b9bda86 100644
> --- a/xdiff/xutils.c
> +++ b/xdiff/xutils.c
> @@ -245,17 +245,19 @@ static unsigned long
> xdl_hash_record_with_whitespace(char const **data,
> while (ptr + 1 < top && isspace(ptr[1])
> && ptr[1] != '\n')
> ptr++;
> - if (flags & XDF_IGNORE_WHITESPACE_CHANGE
> - && ptr[1] != '\n') {
> - ha += (ha << 5);
> - ha ^= (unsigned long) ' ';
> - }
> - if (flags & XDF_IGNORE_WHITESPACE_AT_EOL
> - && ptr[1] != '\n') {
> - while (ptr2 != ptr + 1) {
> + if( ! ( flags & XDF_IGNORE_WHITESPACE
... this is just plain ugly, not to mention breaking the coding style of
the surrounding code in a rather blatant way.
> )){
> + if( flags & XDF_IGNORE_WHITESPACE_CHANGE
> + && ptr[1] != '\n') {
> ha += (ha << 5);
> - ha ^= (unsigned long) *ptr2;
> - ptr2++;
> + ha ^= (unsigned long) ' ';
> + }
> + else if( flags & XDF_IGNORE_WHITESPACE_AT_EOL
> + && ptr[1] != '\n') {
> + while (ptr2 != ptr + 1) {
> + ha += (ha << 5);
> + ha ^= (unsigned long) *ptr2;
> + ptr2++;
> + }
Besides, I think what you actually wanted is
if (flags & XDF_IGNORE_WHITESPACE)
; /* already handled */
else if (flags & XDF_IGNORE_WHITESPACE_CHANGE)
...
else if (flags & XDF_IGNORE_WHITESPACE_AT_EOL)
...
for improved readability both of the code and the patch.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH v2] git-svn: Add --localtime option to "fetch"
From: Junio C Hamano @ 2009-01-19 3:46 UTC (permalink / raw)
To: Eric Wong; +Cc: Pete Harlan, Git mailing list
In-Reply-To: <20090119004318.GA5128@untitled>
Thanks, both.
^ permalink raw reply
* Re: [PATCH 3/4] Documentation: mention branches rather than heads
From: Junio C Hamano @ 2009-01-19 3:46 UTC (permalink / raw)
To: Anders Melchiorsen; +Cc: git
In-Reply-To: <1232289418-25627-4-git-send-email-mail@cup.kalibalik.dk>
Anders Melchiorsen <mail@cup.kalibalik.dk> writes:
> Most of the git push page talks about branches, so make it consistent
> also in this paragraph.
> Signed-off-by: Anders Melchiorsen <mail@cup.kalibalik.dk>
> ---
> Documentation/git-push.txt | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
> index 6d3c711..a7a6f4c 100644
> --- a/Documentation/git-push.txt
> +++ b/Documentation/git-push.txt
> @@ -57,8 +57,8 @@ Pushing an empty <src> allows you to delete the <dst> ref from
> the remote repository.
> +
> The special refspec `:` (or `+:` to allow non-fast forward updates)
> -directs git to push "matching" heads: for every head that exists on
> -the local side, the remote side is updated if a head of the same name
> +directs git to push "matching" branches: for every branch that exists on
> +the local side, the remote side is updated if a branch of the same name
> already exists on the remote side. This is the default operation mode
> if no explicit refspec is found (that is neither on the command line
> nor in any Push line of the corresponding remotes file---see below).
Consistency is good, and I agree "head" may be suboptimal here as this
part tries to give formal semantics to what various refspecs do.
I first thought it would make more sense to say "ref" instead, just like
the previous paragraph that talks about :<dst> form explains it is a way
to remove a "ref". But we do only matching branches with : syntax these
days since 098e711 ("git-push $URL" without refspecs pushes only matching
branches, 2007-07-01); I agree with the updated text for that reason, but
I think the commit log message is wrong.
Thanks.
^ permalink raw reply
* parent-filter loses my merged branch -- what am I doing wrong?
From: Ask Bjørn Hansen @ 2009-01-19 3:45 UTC (permalink / raw)
To: git
Hi everyone,
I'm converting another svn repository to git (yay). It's only about
1000 commits, but over more than 7 years and a cvs->svn conversion.
On Sam Villain's recommendation I'm spending a bit of time cleaning up
the branches and merges with git filter-branch, but I don't think I'm
quite understanding how it's supposed to work.
I put the repository up here (about 1MB):
git clone git://git.develooper.com/qpsmtpd.git
I started out making a temporary tag for each svn commit, to have
easier to use reference points:
for c in `git rev-list --all --date-order --timestamp | sort -n | awk
'{print $2}'`; do
svnid=`git show -s $c | tail -1 | sed 's/.*svn.perl.org\/qpsmtpd
\///' | sed 's/\ .*//' | sed 's/^branches\///'`
git tag -f $svnid $c
done
Then I tried getting the first merge adjusted to show both parents.
The commit tagged v010@56 should be the second parent for trunk@57
(the original/other parent for trunk@57 is trunk@20).
I tried using:
git filter-branch --tag-name-filter cat --parent-filter '
if test $GIT_COMMIT = $(git rev-parse trunk@57)
then
echo "-p $(git rev-parse trunk@20) -p $(git rev-
parse v010@56)"
else
cat
fi
' \
master
... but that seems to just basically throw away the "v010" branch!
What did I do wrong? (Some of the other problems with this repository
is that we moved the branches around with "svn mv", so some of the
branches don't even have the branch point as a parent; but I'll get
back to that when I get this simple case working).
(The script also loses all the temporary tags I added; I thought "--
tag-name-filter cat" would preserve them?)
- ask
--
http://develooper.com/ - http://askask.com/
^ permalink raw reply
* Re: [PATCH/RFC] git-am: Make it easier to see which patch failed
From: Junio C Hamano @ 2009-01-19 3:38 UTC (permalink / raw)
To: Jeff King; +Cc: Stephan Beyer, Jonas Flodén, git, Johannes Schindelin
In-Reply-To: <20090118153928.GA16664@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Yes, I'm surprised Junio doesn't remember the mass conversions we already had
> to do (4b7cc26a and 293623ed). But looking at the date, I guess it _has_
> been a year and a half. :)
Ok, I forgot, sue me ;-).
Anyway, thanks for spotting. I'll fix it up like this.
-- >8 --
Subject: git-am: re-fix the diag message printing
The $FIRSTLINE variable is from the user's commit and can contain
arbitrary backslash escapes that may be (mis)interpreted when given to
"echo", depending on the implementation. Use "printf" to work around the
issue.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
git-am.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index ae2fe56..cf3d4a7 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -501,7 +501,7 @@ do
fi
if test $apply_status != 0
then
- echo "Patch failed at $msgnum $FIRSTLINE"
+ printf 'Patch failed at %s %s\n' "$msgnum" "$FIRSTLINE"
stop_here_user_resolve $this
fi
--
1.6.1.245.gdd9f9
^ permalink raw reply related
* Re: [RFC PATCH] Fix gitdir detection when in subdir of gitdir
From: Junio C Hamano @ 2009-01-19 3:15 UTC (permalink / raw)
To: SZEDER Gábor
Cc: Johannes Sixt, Johannes Schindelin, SZEDER Gábor, git
In-Reply-To: <20090119020311.GA8753@neumann>
SZEDER Gábor <szeder@fzi.de> writes:
> Thanks. In the meantime I was working on a patch that sets relative
> path in this case, too.
Does it make sense to use relative path in such a case?
If it is for "rev-parse --git-dir", the calling script may learn the
correct location of the GIT_DIR with either relative or absolute, but if
it is for the internal consumption of git process itself and any
subprocess forked from us that look at GIT_DIR we export, the process
already runs at the repository root (because you do not chdir back) and
using relative path does not make much sense. Exported GIT_DIR has to be
either "." or the full path from the root to make sense to such a user, I
think.
^ permalink raw reply
* Re: [PATCH 2/2] http-push: remove MOVE step after PUT when sending objects to server
From: Junio C Hamano @ 2009-01-19 3:07 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Junio C Hamano, Johannes Schindelin, Ray Chuan, git
In-Reply-To: <bd6139dc0901181612p5181c36eub337a339cd777da0@mail.gmail.com>
"Sverre Rabbelier" <srabbelier@gmail.com> writes:
> I totally detest having to use svn because of this), it would be nice
> to not dismiss http as "being slow anyway, so who cares about not
> making it faster"?
Nobody is arguing for "keeping it slow at all costs".
But "replace put && move with a single put, and we do not care if that
corrupts the resulting repository if it gets interrupted" is a different
story.
^ permalink raw reply
* Re: [PATCH] git-svn: Show UUID in svn info for added directories with svn 1.5.5
From: Eric Wong @ 2009-01-19 3:04 UTC (permalink / raw)
To: Marcel Koeppen; +Cc: git
In-Reply-To: <1232330521-50197-1-git-send-email-git-dev@marzelpan.de>
Marcel Koeppen <git-dev@marzelpan.de> wrote:
> In svn 1.5.5 the output of "svn info" for added directories was changed
> and now shows the repository UUID. This patch implements the same
> behavior for "git svn info" and makes t9119-git-svn-info.17 pass if
> svn 1.5.5 is used.
>
> Signed-off-by: Marcel Koeppen <git-dev@marzelpan.de>
Thanks Marcel,
Acked-by: Eric Wong <normalperson@yhbt.net>
> ---
> git-svn.perl | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index ad01e18..2f16a4e 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -911,7 +911,8 @@ sub cmd_info {
> if ($@) {
> $result .= "Repository Root: (offline)\n";
> }
> - $result .= "Repository UUID: $uuid\n" unless $diff_status eq "A";
> + $result .= "Repository UUID: $uuid\n" unless $diff_status eq "A" &&
> + ($SVN::Core::VERSION le '1.5.4' || $file_type ne "dir");
> $result .= "Revision: " . ($diff_status eq "A" ? 0 : $rev) . "\n";
>
> $result .= "Node Kind: " .
> --
^ permalink raw reply
* Re: [PATCH 2/3] Teach read_tree_recursive() how to traverse into submodules
From: Junio C Hamano @ 2009-01-19 3:02 UTC (permalink / raw)
To: Lars Hjemli; +Cc: Johannes Schindelin, git
In-Reply-To: <8c5c35580901180945u17a69140vff2736765ee6073@mail.gmail.com>
Lars Hjemli <hjemli@gmail.com> writes:
> On Sun, Jan 18, 2009 at 16:48, Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> ...
>> Seems you want to fall back to look in the superproject's object database.
>> But I think that is wrong, as I have a superproject with many platform
>> dependent submodules, only one of which is checked out, and for
>> convenience, the submodules all live in the superproject's repository.
>
> Actually, I want this to work for bare repositories by specifying the
> submodule odbs in the alternates file. So if the current submodule odb
> wasn't found my plan was to check if the commit object was accessible
> anyways but don't die() if it wasn't.
The current submodule design is "do not recurse into them by default
without being told" throughout the Porcelain. We can think of various
ways for the users to tell which submodules are of interest and which are
uninteresting.
The most general solution would be to give a list of submodules you are
interested in recursing into from the command line, something like:
$ git command --with-submodule=path1 --with-submodule=path2...
That approach would work equally "well" with a bare repository or with a
non-bare repository, but if you have N submodules, you need to give up to
N extra options, which may be cumbersome (meaning, "works equally well"
above actually may mean "works equally awkwardly"). One way to solve
awkwardness may be to support a mechanism that allows you to use
configuration variables to name a group of submodules.
In addition to such configuration variables, you already have one default
group of submodules, defined by the way you set up your work tree, when
your superproject does have a work tree. Some submodules have
repositories cloned in the work tree, while some don't, and the ones
without clones can be defined as "uninteresting ones" (to the work tree
owner) that are outside the default group. For many work tree oriented
operations, it may even make sense to allow that group to be used with a
single "git command --with-submodule" (i.e. when you do not say which
submodule you mean, that can default to "cloned" group).
I do not know "has an entry in the superproject's alternate list that
points to its object store" is a good basis to define another default
group useful especially in a bare repository setting; you seem to be
suggesting that, and you might be correct.
For "git archive", however, I suspect the "default group based on work
tree checkout state" may make the least sense. "git archive HEAD" is
expected to give a reproducible dump of the state recorded by the HEAD
commit no matter who runs it in what repository, and I think there should
be a conscious and explicit instruction from the end user that says "Here
is a dump from this commit in the superproject, *BUT* it was made together
with contents from this and that submodule". Command line options that
list "this and that submodule" is explicit enough, and a configured
nickname given to a known group of submodules from the command line may be
so as well, but the group based on the checkout state feels a bit too
implicit and magical to my taste. The group based on the "has an entry in
superproject's alternates" criterion is not much better in this regard,
methinks.
Another worrysome thing about "git archive" is that it marks the resulting
archive with the commit object name the tarball was taken from. If you
allow recursing into an arbitrary subset of submodule, a project with N
submodules can produce 2^N different varieties of archive, all marked with
the same commit object name from the superproject. That might be a bit
too confusing.
^ permalink raw reply
* Re: how to track multiple upstreams in one repository
From: david @ 2009-01-19 3:58 UTC (permalink / raw)
To: Bryan Donlan; +Cc: git
In-Reply-To: <20090119021426.GA21999@shion.is.fushizen.net>
On Sun, 18 Jan 2009, Bryan Donlan wrote:
> On Sun, Jan 18, 2009 at 06:58:06PM -0800, david@lang.hm wrote:
>> for linux I want to track both the linus tree and the -stable tree.
>> Ideally I want to be able to do a checkout of tags from either tree from
>> the same directory (along with diffs between items in both trees, etc)
>>
>> I have found documentation on how to clone from each of them, but I
>> haven't found any simple documentation on how to work with both of them.
>
> After cloning from one:
> git remote add remotename git://...
> git fetch remotename
>
> You will now have the other repository fetched into your local
> repository; tags from both will be replicated to your local tags.
thanks, given the nature of git I figured it was something really simple,
but I just wasn't able to find it.
I've forwarded this to the kernel.org webmaster to update the 'how to
follow linux development' page
David Lang
^ permalink raw reply
* Re: git-svn: File was not found in commit
From: Eric Wong @ 2009-01-19 2:41 UTC (permalink / raw)
To: Morgan Christiansson; +Cc: git
In-Reply-To: <496B497F.30109@mog.se>
Morgan Christiansson <git@mog.se> wrote:
> Eric Wong wrote:
>> Eric Wong <normalperson@yhbt.net> wrote:
>>
>>> Morgan Christiansson <git@mog.se> wrote:
>>>
>>>> The "Ignoring path" message appears to be coming from git which is
>>>> refusing to commit the .git directory. Which leads to git-svn being
>>>> unaware of the files being ignored and giving an error when it
>>>> can't find them.
>>>> I'm personally fine with these files being ignored by git,
>>>> but git-svn needs to be aware that they are not added to the
>>>> repository.
>>>>
>>> Hi Morgan,
>>> Can you try the following rough patch and see it it fixes things
>>> for you? Thanks!
>>>
>>
>> Actually, I think this patch is broken (my quickly put together test
>> case was insufficient)...
>>
>
> Yes it was. apply_textdelta() is never called for my repo so it has no
> effect.
>
> I've attached an updated and simplified version of the testcase you sent
> that correctly triggers the bug i reported.
>
> I'm not a native perl coder though so I don't think I would be able to
> provide a clean fix for this. But I've traced through enough of the
> program to see that the .git directories should be filtered out as early
> as possible to mimick the behaviour of git.
Hi Morgan, the following patch should fix your problem.
>From b03a71a660d15d76b63d7d3c5205b896f89f34b5 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Sun, 11 Jan 2009 18:23:38 -0800
Subject: [PATCH] git-svn: avoid importing nested git repos
Some SVN repositories contain git repositories within them
(hopefully accidentally checked in). Since git refuses to track
nested ".git" repositories, this can be a problem when fetching
updates from SVN.
Thanks to Morgan Christiansson for the report and testing.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
git-svn.perl | 34 +++++++++++--
t/t9133-git-svn-nested-git-repo.sh | 101 ++++++++++++++++++++++++++++++++++++
2 files changed, 131 insertions(+), 4 deletions(-)
create mode 100755 t/t9133-git-svn-nested-git-repo.sh
diff --git a/git-svn.perl b/git-svn.perl
index 71b8ef4..55c4dfb 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3291,6 +3291,11 @@ sub _mark_empty_symlinks {
\%ret;
}
+# returns true if a given path is inside a ".git" directory
+sub in_dot_git {
+ $_[0] =~ m{(?:^|/)\.git(?:/|$)};
+}
+
sub set_path_strip {
my ($self, $path) = @_;
$self->{path_strip} = qr/^\Q$path\E(\/|$)/ if length $path;
@@ -3316,6 +3321,7 @@ sub git_path {
sub delete_entry {
my ($self, $path, $rev, $pb) = @_;
+ return undef if in_dot_git($path);
my $gpath = $self->git_path($path);
return undef if ($gpath eq '');
@@ -3343,8 +3349,12 @@ sub delete_entry {
sub open_file {
my ($self, $path, $pb, $rev) = @_;
+ my ($mode, $blob);
+
+ goto out if in_dot_git($path);
+
my $gpath = $self->git_path($path);
- my ($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath)
+ ($mode, $blob) = (command('ls-tree', $self->{c}, '--', $gpath)
=~ /^(\d{6}) blob ([a-f\d]{40})\t/);
unless (defined $mode && defined $blob) {
die "$path was not found in commit $self->{c} (r$rev)\n";
@@ -3352,20 +3362,27 @@ sub open_file {
if ($mode eq '100644' && $self->{empty_symlinks}->{$path}) {
$mode = '120000';
}
+out:
{ path => $path, mode_a => $mode, mode_b => $mode, blob => $blob,
pool => SVN::Pool->new, action => 'M' };
}
sub add_file {
my ($self, $path, $pb, $cp_path, $cp_rev) = @_;
- my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);
- delete $self->{empty}->{$dir};
- { path => $path, mode_a => 100644, mode_b => 100644,
+ my $mode;
+
+ if (!in_dot_git($path)) {
+ my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);
+ delete $self->{empty}->{$dir};
+ $mode = '100644';
+ }
+ { path => $path, mode_a => $mode, mode_b => $mode,
pool => SVN::Pool->new, action => 'A' };
}
sub add_directory {
my ($self, $path, $cp_path, $cp_rev) = @_;
+ goto out if in_dot_git($path);
my $gpath = $self->git_path($path);
if ($gpath eq '') {
my ($ls, $ctx) = command_output_pipe(qw/ls-tree
@@ -3383,11 +3400,13 @@ sub add_directory {
my ($dir, $file) = ($path =~ m#^(.*?)/?([^/]+)$#);
delete $self->{empty}->{$dir};
$self->{empty}->{$path} = 1;
+out:
{ path => $path };
}
sub change_dir_prop {
my ($self, $db, $prop, $value) = @_;
+ return undef if in_dot_git($db->{path});
$self->{dir_prop}->{$db->{path}} ||= {};
$self->{dir_prop}->{$db->{path}}->{$prop} = $value;
undef;
@@ -3395,6 +3414,7 @@ sub change_dir_prop {
sub absent_directory {
my ($self, $path, $pb) = @_;
+ return undef if in_dot_git($pb->{path});
$self->{absent_dir}->{$pb->{path}} ||= [];
push @{$self->{absent_dir}->{$pb->{path}}}, $path;
undef;
@@ -3402,6 +3422,7 @@ sub absent_directory {
sub absent_file {
my ($self, $path, $pb) = @_;
+ return undef if in_dot_git($pb->{path});
$self->{absent_file}->{$pb->{path}} ||= [];
push @{$self->{absent_file}->{$pb->{path}}}, $path;
undef;
@@ -3409,6 +3430,7 @@ sub absent_file {
sub change_file_prop {
my ($self, $fb, $prop, $value) = @_;
+ return undef if in_dot_git($fb->{path});
if ($prop eq 'svn:executable') {
if ($fb->{mode_b} != 120000) {
$fb->{mode_b} = defined $value ? 100755 : 100644;
@@ -3424,11 +3446,13 @@ sub change_file_prop {
sub apply_textdelta {
my ($self, $fb, $exp) = @_;
+ return undef if (in_dot_git($fb->{path}));
my $fh = $::_repository->temp_acquire('svn_delta');
# $fh gets auto-closed() by SVN::TxDelta::apply(),
# (but $base does not,) so dup() it for reading in close_file
open my $dup, '<&', $fh or croak $!;
my $base = $::_repository->temp_acquire('git_blob');
+
if ($fb->{blob}) {
my ($base_is_link, $size);
@@ -3469,6 +3493,8 @@ sub apply_textdelta {
sub close_file {
my ($self, $fb, $exp) = @_;
+ return undef if (in_dot_git($fb->{path}));
+
my $hash;
my $path = $self->git_path($fb->{path});
if (my $fh = $fb->{fh}) {
diff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh
new file mode 100755
index 0000000..893f57e
--- /dev/null
+++ b/t/t9133-git-svn-nested-git-repo.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+#
+# Copyright (c) 2009 Eric Wong
+#
+
+test_description='git svn property tests'
+. ./lib-git-svn.sh
+
+test_expect_success 'setup repo with a git repo inside it' '
+ svn co "$svnrepo" s &&
+ (
+ cd s &&
+ git init &&
+ test -f .git/HEAD &&
+ > .git/a &&
+ echo a > a &&
+ svn add .git a &&
+ svn commit -m "create a nested git repo" &&
+ svn up &&
+ echo hi >> .git/a &&
+ svn commit -m "modify .git/a" &&
+ svn up
+ )
+'
+
+test_expect_success 'clone an SVN repo containing a git repo' '
+ git svn clone "$svnrepo" g &&
+ echo a > expect &&
+ test_cmp expect g/a
+'
+
+test_expect_success 'SVN-side change outside of .git' '
+ (
+ cd s &&
+ echo b >> a &&
+ svn commit -m "SVN-side change outside of .git" &&
+ svn up &&
+ svn log -v | fgrep "SVN-side change outside of .git"
+ )
+'
+
+test_expect_success 'update git svn-cloned repo' '
+ (
+ cd g &&
+ git svn rebase &&
+ echo a > expect &&
+ echo b >> expect &&
+ test_cmp a expect &&
+ rm expect
+ )
+'
+
+test_expect_success 'SVN-side change inside of .git' '
+ (
+ cd s &&
+ git add a &&
+ git commit -m "add a inside an SVN repo" &&
+ git log &&
+ svn add --force .git &&
+ svn commit -m "SVN-side change inside of .git" &&
+ svn up &&
+ svn log -v | fgrep "SVN-side change inside of .git"
+ )
+'
+
+test_expect_success 'update git svn-cloned repo' '
+ (
+ cd g &&
+ git svn rebase &&
+ echo a > expect &&
+ echo b >> expect &&
+ test_cmp a expect &&
+ rm expect
+ )
+'
+
+test_expect_success 'SVN-side change in and out of .git' '
+ (
+ cd s &&
+ echo c >> a &&
+ git add a &&
+ git commit -m "add a inside an SVN repo" &&
+ svn commit -m "SVN-side change in and out of .git" &&
+ svn up &&
+ svn log -v | fgrep "SVN-side change in and out of .git"
+ )
+'
+
+test_expect_success 'update git svn-cloned repo again' '
+ (
+ cd g &&
+ git svn rebase &&
+ echo a > expect &&
+ echo b >> expect &&
+ echo c >> expect &&
+ test_cmp a expect &&
+ rm expect
+ )
+'
+
+test_done
--
Eric Wong
^ permalink raw reply related
* Re: how to track multiple upstreams in one repository
From: Bryan Donlan @ 2009-01-19 2:14 UTC (permalink / raw)
To: david; +Cc: git
In-Reply-To: <alpine.DEB.1.10.0901181855400.20741@asgard.lang.hm>
On Sun, Jan 18, 2009 at 06:58:06PM -0800, david@lang.hm wrote:
> for linux I want to track both the linus tree and the -stable tree.
> Ideally I want to be able to do a checkout of tags from either tree from
> the same directory (along with diffs between items in both trees, etc)
>
> I have found documentation on how to clone from each of them, but I
> haven't found any simple documentation on how to work with both of them.
After cloning from one:
git remote add remotename git://...
git fetch remotename
You will now have the other repository fetched into your local
repository; tags from both will be replicated to your local tags.
^ permalink raw reply
* Re: how to track multiple upstreams in one repository
From: A Large Angry SCM @ 2009-01-19 2:18 UTC (permalink / raw)
To: david; +Cc: git
In-Reply-To: <alpine.DEB.1.10.0901181855400.20741@asgard.lang.hm>
[-- Attachment #1: Type: text/plain, Size: 461 bytes --]
david@lang.hm wrote:
> for linux I want to track both the linus tree and the -stable tree.
> Ideally I want to be able to do a checkout of tags from either tree from
> the same directory (along with diffs between items in both trees, etc)
>
> I have found documentation on how to clone from each of them, but I
> haven't found any simple documentation on how to work with both of them.
Attached are what I use. It's not pretty but it's works for me; YMMV.
[-- Attachment #2: fred.sh --]
[-- Type: application/x-shellscript, Size: 432 bytes --]
[-- Attachment #3: fred_history --]
[-- Type: text/plain, Size: 2334 bytes --]
export GIT_COMMITTER_NAME="@"
export GIT_AUTHOR_NAME="@"
./fred.sh git://git.kernel.org/pub/scm/git/git.git git/git
./fred.sh git://git.kernel.org/pub/scm/gitk/gitk.git gitk/gitk
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/sparse.git torvalds/sparse
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git torvalds/linux-2.6
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.11.y.git stable/linux-2.6.11.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.12.y.git stable/linux-2.6.12.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.13.y.git stable/linux-2.6.13.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.14.y.git stable/linux-2.6.14.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.15.y.git stable/linux-2.6.15.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.16.y.git stable/linux-2.6.16.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.17.y.git stable/linux-2.6.17.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.18.y.git stable/linux-2.6.18.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.19.y.git stable/linux-2.6.19.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.20.y.git stable/linux-2.6.20.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.21.y.git stable/linux-2.6.21.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.22.y.git stable/linux-2.6.22.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.23.y.git stable/linux-2.6.23.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.24.y.git stable/linux-2.6.24.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.25.y.git stable/linux-2.6.25.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.26.y.git stable/linux-2.6.26.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.27.y.git stable/linux-2.6.27.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.28.y.git stable/linux-2.6.28.y
./fred.sh git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git tglx/history
^ permalink raw reply
* [PATCH] t1500: extend with tests of 'git rev-parse --git-dir'
From: SZEDER Gábor @ 2009-01-19 2:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Sixt, Johannes Schindelin, git
In-Reply-To: <7vhc3wuwxb.fsf@gitster.siamese.dyndns.org>
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
These will pass with Junio's follow-up.
t/t1500-rev-parse.sh | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 85da4ca..48ee077 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -26,21 +26,28 @@ test_rev_parse() {
"test '$1' = \"\$(git rev-parse --show-prefix)\""
shift
[ $# -eq 0 ] && return
+
+ test_expect_success "$name: git-dir" \
+ "test '$1' = \"\$(git rev-parse --git-dir)\""
+ shift
+ [ $# -eq 0 ] && return
}
-# label is-bare is-inside-git is-inside-work prefix
+# label is-bare is-inside-git is-inside-work prefix git-dir
+
+ROOT=$(pwd)
-test_rev_parse toplevel false false true ''
+test_rev_parse toplevel false false true '' .git
cd .git || exit 1
-test_rev_parse .git/ false true false ''
+test_rev_parse .git/ false true false '' .
cd objects || exit 1
-test_rev_parse .git/objects/ false true false ''
+test_rev_parse .git/objects/ false true false '' "$ROOT/.git"
cd ../.. || exit 1
mkdir -p sub/dir || exit 1
cd sub/dir || exit 1
-test_rev_parse subdirectory false false true sub/dir/
+test_rev_parse subdirectory false false true sub/dir/ "$ROOT/.git"
cd ../.. || exit 1
git config core.bare true
--
1.6.1.201.g0e7e.dirty
^ permalink raw reply related
* Re: [RFC PATCH] Fix gitdir detection when in subdir of gitdir
From: SZEDER Gábor @ 2009-01-19 2:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Sixt, Johannes Schindelin, SZEDER Gábor, git
In-Reply-To: <7vhc3wuwxb.fsf@gitster.siamese.dyndns.org>
On Sun, Jan 18, 2009 at 01:27:44PM -0800, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > I think (1) the solution (almost) makes sense, (2) the patch needs to be
> > explained a lot better as you mentioned in your two messages, and (3) if
> > it does not affect any other case than when you are in a subdirectory of
> > the .git/ directory, then you are doing something funny anyway and
> > performance issue Dscho mentions, if any, is not a concern.
> >
> > My "(almost)" in (1) above is because the patch uses this new behaviour
> > even when you are inside the .git/ directory itself (or at the root of a
> > bare repository), which is a very common case that we do not have to nor
> > want to change the behaviour. It also invalidates the precondition of (3)
> > above.
>
> And this is a trivial follow-up on top of Szeder's patch.
Thanks. In the meantime I was working on a patch that sets relative
path in this case, too. I got it almost working: all tests passed
except '.git/objects/: is-bare-repository' in 't1500-rev-parse'. I
couldn't figure it out why this test failed, however.
In case somebody might be interested for such an uncommon case, the
patch is below.
Best,
Gábor
setup.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index 6b277b6..b4d37d7 100644
--- a/setup.c
+++ b/setup.c
@@ -375,7 +375,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
static char cwd[PATH_MAX+1];
const char *gitdirenv;
const char *gitfile_dir;
- int len, offset, ceil_offset;
+ int len, offset, ceil_offset, cdup_count = 0;
/*
* Let's assume that we are in a git repository.
@@ -453,10 +453,22 @@ const char *setup_git_directory_gently(int *nongit_ok)
if (is_git_directory(DEFAULT_GIT_DIR_ENVIRONMENT))
break;
if (is_git_directory(".")) {
+ char gd_rel_path[PATH_MAX];
inside_git_dir = 1;
if (!work_tree_env)
inside_work_tree = 0;
- setenv(GIT_DIR_ENVIRONMENT, ".", 1);
+ if (cdup_count) {
+ char *p = gd_rel_path;
+ while (cdup_count-- > 1) {
+ *p++ = '.'; *p++ = '.'; *p++ = '/';
+ }
+ *p++ = '.'; *p++ = '.';
+ *p = '\0';
+ } else {
+ gd_rel_path[0] = '.';
+ gd_rel_path[1] = '\0';
+ }
+ setenv(GIT_DIR_ENVIRONMENT, gd_rel_path, 1);
check_repository_format_gently(nongit_ok);
return NULL;
}
@@ -472,6 +484,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
}
if (chdir(".."))
die("Cannot change to %s/..: %s", cwd, strerror(errno));
+ cdup_count++;
}
inside_git_dir = 0;
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox