* [PATCH] git rev-parse: Fix --show-cdup inside symlinked directory
From: Petr Baudis @ 2008-07-15 14:59 UTC (permalink / raw)
To: gitster; +Cc: git
In-Reply-To: <1216131208.19334.171.camel@gemini>
Consider the scenario when someone makes a symlink into a working tree
subdirectory at an unrelated place, then attempts to work inside the
symlinked directory. The scenario is a bit unwieldly, but most of
the Git will handle it fine - except git rev-parse --show-cdup. That
will output a sequence of ../ which will work wrong inside the symlink
using shell cd builtin.
This patch changes --show-cdup to always show absolute workdir path
instead. I think this should hopefully cause no compatibility problems;
the testsuite is passing fine, at least. The patch also adds
a --show-cdup check and this particular scenartio to the t1500 test.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
Documentation/git-rev-parse.txt | 4 ++--
builtin-rev-parse.c | 15 +++++----------
t/t1500-rev-parse.sh | 18 ++++++++++++++++--
3 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 088f971..4c289d0 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -103,8 +103,8 @@ OPTIONS
--show-cdup::
When the command is invoked from a subdirectory, show the
- path of the top-level directory relative to the current
- directory (typically a sequence of "../", or an empty string).
+ path of the top-level directory, or an empty string if the
+ current directory is the top-level directory.
--git-dir::
Show `$GIT_DIR` if defined else show the path to the .git directory.
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index a7860ed..011d16c 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -500,22 +500,17 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
}
if (!strcmp(arg, "--show-cdup")) {
- const char *pfx = prefix;
- if (!is_inside_work_tree()) {
+ if (prefix) {
+ /* We are not at the top level yet */
const char *work_tree =
get_git_work_tree();
if (work_tree)
printf("%s\n", work_tree);
continue;
+ } else {
+ /* Backwards compatibility */
+ putchar('\n');
}
- while (pfx) {
- pfx = strchr(pfx, '/');
- if (pfx) {
- pfx++;
- printf("../");
- }
- }
- putchar('\n');
continue;
}
if (!strcmp(arg, "--git-dir")) {
diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh
index 85da4ca..2f0bf15 100755
--- a/t/t1500-rev-parse.sh
+++ b/t/t1500-rev-parse.sh
@@ -26,9 +26,14 @@ test_rev_parse() {
"test '$1' = \"\$(git rev-parse --show-prefix)\""
shift
[ $# -eq 0 ] && return
+
+ test_expect_success "$name: cdup" \
+ "test '$1' = \"\$(git rev-parse --show-cdup)\""
+ shift
+ [ $# -eq 0 ] && return
}
-# label is-bare is-inside-git is-inside-work prefix
+# label is-bare is-inside-git is-inside-work prefix cdup
test_rev_parse toplevel false false true ''
@@ -38,11 +43,20 @@ cd objects || exit 1
test_rev_parse .git/objects/ false true false ''
cd ../.. || exit 1
+basedir=$(pwd)
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/ "$basedir"
cd ../.. || exit 1
+# Scenario: Working within a subdirectory symlinked out of the working tree
+mkdir -p maindir || exit 1
+(mv .git maindir && mkdir -p maindir/sub2 && ln -s maindir/sub2 .) || exit 1
+cd sub2 || exit 1
+test_rev_parse 'symlinked subdirectory' false false true sub2/ "$basedir"/maindir
+cd .. || exit 1
+(rm sub2 && mv maindir/.git . && rm -r maindir) || exit 1
+
git config core.bare true
test_rev_parse 'core.bare = true' true false false
^ permalink raw reply related
* Re: git stash save --keep-index
From: Sverre Rabbelier @ 2008-07-15 14:50 UTC (permalink / raw)
To: SZEDER Gábor; +Cc: Git Mailinglist
In-Reply-To: <20080715142615.GI8224@neumann>
On Tue, Jul 15, 2008 at 4:26 PM, SZEDER Gábor <szeder@ira.uka.de> wrote:
> If there are unstaged changes in the worktree, then yes, 'git stash
> apply/pop' will error out complaining about dirty state. However, if
> there are changes in the index, but no unstaged changes in the
> worktree, then apply/pop should work (assuming there are no conflicts,
> of course).
>
> So, you won't need that temporary commit, if you have not modified
> anything or have added all changes to the index since 'git stash
> save --keep-index'.
Mhhh, ok, I can live with that, thanks!
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* git config oddity
From: Sverre Rabbelier @ 2008-07-15 14:44 UTC (permalink / raw)
To: Git Mailinglist
Heya,
I noticed today that when unsetting the last value in a group git
config leaves the empty group header. I was somewhat surprised here,
but I am guessing it has a purpose? Anyway, I also noticed (and this
threw my manual config parser off) that when later on an option is set
to that empty group, a new group is created with the same name. Is
this something I have to deal with in my parser (e.g., should I keep
scanning the file for occurrences of my header and allow for empty
groups, or is this a bug in git config? Either is fine with me, was
just wondering :).
-----------------
sverre@Laptop-Sverre:~/code$ mkdir config-oddity
sverre@Laptop-Sverre:~/code$ cd config-oddity/
sverre@Laptop-Sverre:~/code/config-oddity$ git init
Initialized empty Git repository in /home/sverre/code/config-oddity/.git/
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sverre@Laptop-Sverre:~/code/config-oddity$ git config foo.bar spam
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config # as expected
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[foo]
bar = spam
sverre@Laptop-Sverre:~/code/config-oddity$ git config --unset foo.bar
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config # dubious,
but acceptable
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[foo]
sverre@Laptop-Sverre:~/code/config-oddity$ git config foo.bar eggs
sverre@Laptop-Sverre:~/code/config-oddity$ cat .git/config # errr? two
[foo] headers?
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[foo]
[foo]
bar = eggs
sverre@Laptop-Sverre:~/code/config-oddity$
-----------------
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: Standard "git svn init ; git svn fetch" behavior
From: Peter Harris @ 2008-07-15 14:37 UTC (permalink / raw)
To: Peter Valdemar Mørch (Lists); +Cc: git
In-Reply-To: <487C88D0.30609@sneakemail.com>
On Tue, Jul 15, 2008 at 7:24 AM, "Peter Valdemar Mørch (Lists)" wrote:
>
> 1) It seems the svn tags were converted into git branches such as
> "tags/mytag". Is that normal?
Yes.
Subversion doesn't really have tags. They're just branches with 'tag'
in the name. git-svn wants them to be branches on the git side so that
it can track future commits to the 'tag'.
> Re: 2) Why does master end up being off of tags/mytag instead of off of
> trunk?
>
> I would have expected, that "master" ended up tracking "trunk", and not
> tags/mytag. Why track an obscure tag instead of trunk?
Some projects work on trunk and keep a maint branch. Some projects
work on branches, and only merge bug fixes to trunk. To facilitate
this model, git-svn tries to guess which branch is your working
branch, and picks that one to be master.
In this case, you were unlucky enough to have the most recent commit
be on a tag-branch.
> Is there a smarter way to find out what branchpoint was used to create
> "master"? (I'm new to git, and find it difficult to see what my branches
> were "made from")
Git doesn't know what any particular branch was "made from", as the
branch point in question may be an ancestor of any number of other
branches.
git-svn does keep track of the subversion branch you are working on.
"git svn info"
Peter Harris
^ permalink raw reply
* Re: git stash save --keep-index
From: SZEDER Gábor @ 2008-07-15 14:26 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Git Mailinglist
In-Reply-To: <bd6139dc0807150531k4f0a1a4yee2c8ec2b98ee39c@mail.gmail.com>
Hi Sverre,
On Tue, Jul 15, 2008 at 02:31:54PM +0200, Sverre Rabbelier wrote:
> <hack hack hack>
> $ git add # or -i / -p
> $ git stash save --keep-index
> <test if staged changes are ready to be commited>
> $ git commit
> $ git stash pop
> <lather, rinse, repeat>
>
> But what happens if in the testing phase you detect that the commit is
> not ready yet, or even, some of the changes you staged should have
> been kept? It would make sense to 'undo' the stash the usual way:
> $ git stash pop
> But alas, it is not possible to apply on a dirty working directory, so
> one has to resort to:
> $ git commit -m "tmp"
> $ git stash pop
> $ git reset HEAD^
If there are unstaged changes in the worktree, then yes, 'git stash
apply/pop' will error out complaining about dirty state. However, if
there are changes in the index, but no unstaged changes in the
worktree, then apply/pop should work (assuming there are no conflicts,
of course).
So, you won't need that temporary commit, if you have not modified
anything or have added all changes to the index since 'git stash
save --keep-index'.
Gábor
^ permalink raw reply
* git-rev-parse --show-cdup returns a relative path instead of absolute (problem with git pull --rebase not finding the git dir)
From: Yves Orton @ 2008-07-15 14:13 UTC (permalink / raw)
To: git
Hi,
Im reporting this based on a conversation I had in the #git channel on
freenode.
I have a setup where various subdirectories of a number of git repos are
symlinked into a common directory tree. Something like what the
following would create but with more repositories involved:
cd ~; mkdir foo; chdir foo; git init; mkdir bar; git add bar ; git
commit -m'add bar' ; cd ~; ln -s foo/bar bar ; cd bar;
[try various git commands, not all will work]
Most git command seem perfectly happy to work on the correct repos from
this symlinked tree. However at least one doesnt, git pull --rebase, in
particular.
Doing a
git-rev-parse --git-dir
seems to behave correctly (always finding the correct location) and
git-rev-parse --is-inside-work-dir
reports true. However git-pull --rebase responds with lots of "fatal:
Not a git repository" messages. Example is below.
During discussion about this on #git it was suggested this was because
git-rev-parse --show-cdup
returns a relative path. (../).
Im not on list so id appreciate it if anyone replying to this could cc
me on the mail.
Oh, i am aware of submodules but i have to work with what i have now.
Cheers,
yves
Example of git pull --rebase failing yet git commit working:
[dmq@somewhere apps]$ echo test > test.txt
[dmq@somewhere apps]$ git add test.txt
[dmq@somewhere apps]$ git commit -m'add a test file -- will remove next
commit'
Created commit 45ab725: add a test file -- will remove next commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 apps/test.txt
[dmq@somewhere apps]$ git rm test.txt
rm 'apps/test.txt'
[dmq@somewhere apps]$ git commit -m'removed test file'
Created commit 2768e6d: removed test file
1 files changed, 0 insertions(+), 1 deletions(-)
delete mode 100644 apps/test.txt
[dmq@somewhere apps]$ git pull --rebase
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
fatal: Not a git repository
^ permalink raw reply
* Re: [PATCH] Documentation/git-submodule.txt: Add Description section
From: Junio C Hamano @ 2008-07-15 14:06 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <20080715102119.26321.78530.stgit@localhost>
Petr Baudis <pasky@suse.cz> writes:
> Figuring out how submodules work conceptually is quite a bumpy
> ride for a newcomer; the user manual helps (if one knows to actually
> look into it), but the reference documentation should provide good
> quick intro as well. This patch attempts to do that.
Good discussion starter, I think. There seem to be a few technical
inaccuracies though.
I'll wait until the people interested in submodules on the list form
consensus on the wording and contents.
^ permalink raw reply
* Re: [PATCH 1/4] Allow e-mails to be sent with the Unix sendmail tool
From: Mark Brown @ 2008-07-15 12:22 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Karl Hasselstr??m, git
In-Reply-To: <20080713114026.18845.77979.stgit@localhost.localdomain>
On Sun, Jul 13, 2008 at 12:40:26PM +0100, Catalin Marinas wrote:
> If the stgit.smtpserver configuration option does not have a host:port
> format, it is assumed to be an external tool. For example, to use
> sendmail just set this variable to "/usr/sbin/sendmail -t -i" (see the
> examples/gitconfig file).
I'd really expect to be able to just specify the hostname alone if using
the standard SMTP port. Perhaps checking for a / in the server might be
less surprising?
--
"You grabbed my hand and we fell into it, like a daydream - or a fever."
^ permalink raw reply
* Re: [PATCH 1/4] Allow e-mails to be sent with the Unix sendmail tool
From: Karl Hasselström @ 2008-07-15 12:34 UTC (permalink / raw)
To: Mark Brown; +Cc: Catalin Marinas, git
In-Reply-To: <20080715122203.GN25448@sirena.org.uk>
On 2008-07-15 13:22:20 +0100, Mark Brown wrote:
> On Sun, Jul 13, 2008 at 12:40:26PM +0100, Catalin Marinas wrote:
>
> > If the stgit.smtpserver configuration option does not have a
> > host:port format, it is assumed to be an external tool. For
> > example, to use sendmail just set this variable to
> > "/usr/sbin/sendmail -t -i" (see the examples/gitconfig file).
>
> I'd really expect to be able to just specify the hostname alone if
> using the standard SMTP port. Perhaps checking for a / in the server
> might be less surprising?
This is actually what the code does, and what the documentation claims
it should do. It's just the commit message that's confused. Catalin?
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* git stash save --keep-index
From: Sverre Rabbelier @ 2008-07-15 12:31 UTC (permalink / raw)
To: Git Mailinglist
Heya,
I have switched to using next/ recently and have had the chance to try
out the new '--keep-index' option to 'git stash'. I must say that 'git
stash save --keep-index' in combination with 'git add -p' followed by
'e' allows for a really nice workflow where I can split up patches
very easily, and test them before committing anything. IIUC the
'--keep-index' option was added as a response to the request to
support a workflow something like this:
<hack hack hack>
$ git add # or -i / -p
$ git stash save --keep-index
<test if staged changes are ready to be commited>
$ git commit
$ git stash pop
<lather, rinse, repeat>
But what happens if in the testing phase you detect that the commit is
not ready yet, or even, some of the changes you staged should have
been kept? It would make sense to 'undo' the stash the usual way:
$ git stash pop
But alas, it is not possible to apply on a dirty working directory, so
one has to resort to:
$ git commit -m "tmp"
$ git stash pop
$ git reset HEAD^
Nothing too bad surely, but I thought that the '--keep-index' option
was exactly to prevent having to do:
<hack hack hack>
$ git add # or -i / -p
$ git commit -m "tmp"
$ git stash save
<test if now committed changes were indeed ready to be comitted>
So the '--keep-index' option eliminates the need for such a temporary
commit in the (hopefully) common case where the selected changes were
indeed good, but we still need it in the case that the changes were
not ready / need something from the stashed changes.
Am I missing something here? Or is the only/best solution here to just
alias 'git commit -m "tmp" && git stash pop && git reset HEAD^' to
'git undo-stash'?
PS: It'd be nice if I could do 'git stash --keep-index' since I"m used
to 'git stash' automagically defaulting to 'git stash save'.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: [PATCH 1/6] archive: remove args member from struct archiver
From: Karl Hasselström @ 2008-07-15 12:29 UTC (permalink / raw)
To: René Scharfe; +Cc: git, Junio C Hamano
In-Reply-To: <487C5694.7050607@lsrfire.ath.cx>
On 2008-07-15 09:49:40 +0200, René Scharfe wrote:
> [Resent with fixed line wrap.]
And this remark embedded in the commit message. :-P
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Standard "git svn init ; git svn fetch" behavior
From: "Peter Valdemar Mørch (Lists)" @ 2008-07-15 11:24 UTC (permalink / raw)
To: git
Hi,
I've now converted my svn repos to git with
$ git-svn init -T trunk -t tags -b branches file://some/path
$ git svn fetch
Wonderful!
I have two questions about the result:
1) It seems the svn tags were converted into git branches such as
"tags/mytag". Is that normal?
2) Why does master end up being off of tags/mytag instead of off of trunk?
###################################
Re: 1) It seems the svn tags were converted into git branches such as
"tags/mytag". Is that normal?
###################################
$ git tag -l
returns nothing and
$ git branch -a
returns all my svn tags as "tags/<tag>" git branches and all my svn
branches as expected in "the root".
Is that by design? Are there any downsides of creating a script that
foreach $tag ( m|tags/(.*)| ) {
git tag $tag $tag
git branch -r -D $tag
}
I'm cool with doing that, I just wanted to know if this is the expected
behaviour, and/or whether I'll run into trouble later because of a
wierdly converted subversion repository.
###################################
Re: 2) Why does master end up being off of tags/mytag instead of off of
trunk?
###################################
I would have expected, that "master" ended up tracking "trunk", and not
tags/mytag. Why track an obscure tag instead of trunk?
The tail of the fetch:
Successfully followed parent
W: +empty_dir: tags/mytag/probe/userHomedir/foo/cache/zlcache
W: +empty_dir: tags/mytag/probe/userHomedir/foo/pna_menu_items
r7375 = 5d3012afabccd348a5a5b81c5cf28532d324ea1b (tags/mytag)
Checking out files: 100% (2184/2184), done.
Checked out HEAD:
file:///home/pvm/cm/repos/tags/mytag r7375
("mytag" and "foo" replaced internal identifiers present in real output...)
$ git log --pretty=oneline --decorate -n 1
5d3012afabccd348a5a5b81c5cf28532d324ea1b (refs/remotes/tags/mytag,
refs/heads/master) Tag mytag
I rectified it with simply
$ git branch -m master old
$ git checkout -b master trunk
$ git branch -d old
Just wondering: Why is this behaviour the default? Is it a bug?
Is there a smarter way to find out what branchpoint was used to create
"master"? (I'm new to git, and find it difficult to see what my branches
were "made from")
Peter
--
Peter Valdemar Mørch
http://www.morch.com
^ permalink raw reply
* Re: applying and committing patches in a single git command
From: Erez Zilber @ 2008-07-15 11:03 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Boaz Harrosh, s-beyer, git@vger.kernel.org
In-Reply-To: <487C752E.4090707@op5.se>
On Tue, Jul 15, 2008 at 1:00 PM, Andreas Ericsson <ae@op5.se> wrote:
> Erez Zilber wrote:
>>
>> On Tue, Jul 15, 2008 at 11:53 AM, Boaz Harrosh <bharrosh@panasas.com>
>> wrote:
>>>
>>> Erez Zilber wrote:
>>>>
>>>> Hi,
>>>>
>>>> Someone created a patch with git-format-patch and sent it to me. I
>>>> would like to apply & commit the patch. If I use git-apply, it only
>>>> patches my tree without committing it. Now, I need to copy the commit
>>>> log, run git-commit and paste the commit log there. Is there a more
>>>> intelligent way to do that?
>>>>
>>>> Thanks,
>>>> Erez
>>>>
>>> git-am, can take all bunch of them at once
>>>
>>> Boaz
>>>
>>
>> Thanks. I have 2 more questions:
>> 1. How can I tell git-am to take a patch from an e-mail from a gmail
>> account?
>
> You can't, but you can save your gmail message to disc and pass
> the saved file to "git am" (don't use "git-am" over "git am";
> we're trying to get away from that old format of typing).
>
>> 2. If I have the actual patch on my machine (not in an e-mail
>> message), I guess that I need something else (not git-am). Is there
>> anything like that?
>>
>
> git apply patchfile
> patch (-p1) < patchfile
Thanks.
^ permalink raw reply
* [PATCH] Documentation/git-submodule.txt: Add Description section
From: Petr Baudis @ 2008-07-15 10:22 UTC (permalink / raw)
To: gitster; +Cc: git
Figuring out how submodules work conceptually is quite a bumpy
ride for a newcomer; the user manual helps (if one knows to actually
look into it), but the reference documentation should provide good
quick intro as well. This patch attempts to do that.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
Documentation/git-submodule.txt | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 105fc2d..3413704 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -16,6 +16,24 @@ SYNOPSIS
'git submodule' [--quiet] summary [--summary-limit <n>] [commit] [--] [<path>...]
+DESCRIPTION
+-----------
+Submodules are a special kind of tree entries which do not refer to a blob or
+a directory, but to a particular tree in another repository (living at a given
+URL). The tree entry describes the existence of a submodule with the given
+name and the exact revision that should be used, while the location of the
+repository is described in the `/.gitmodules` file. This command will manage
+the tree entries and contents of this file for you, as well as inspecting the
+status of your submodules and updating them.
+
+When adding a new submodule to the tree, the 'add' subcommand is to be used.
+However, when pulling a tree containing submodules, these will not be checked
+out by default; the 'init' and 'update' subcommands will maintain submodules
+checked out and at appropriate revision in your working tree. You can inspect
+the current status of your submodules using the 'submodule' subcommand and get
+an overview of changes 'update' would perform using the 'summary' subcommand.
+
+
COMMANDS
--------
add::
^ permalink raw reply related
* Re: applying and committing patches in a single git command
From: Andreas Ericsson @ 2008-07-15 10:00 UTC (permalink / raw)
To: Erez Zilber; +Cc: Boaz Harrosh, s-beyer, git@vger.kernel.org
In-Reply-To: <ce513bcc0807150246g790ca009vc0a76bd6ef0aac9b@mail.gmail.com>
Erez Zilber wrote:
> On Tue, Jul 15, 2008 at 11:53 AM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>> Erez Zilber wrote:
>>> Hi,
>>>
>>> Someone created a patch with git-format-patch and sent it to me. I
>>> would like to apply & commit the patch. If I use git-apply, it only
>>> patches my tree without committing it. Now, I need to copy the commit
>>> log, run git-commit and paste the commit log there. Is there a more
>>> intelligent way to do that?
>>>
>>> Thanks,
>>> Erez
>>>
>> git-am, can take all bunch of them at once
>>
>> Boaz
>>
>
> Thanks. I have 2 more questions:
> 1. How can I tell git-am to take a patch from an e-mail from a gmail account?
You can't, but you can save your gmail message to disc and pass
the saved file to "git am" (don't use "git-am" over "git am";
we're trying to get away from that old format of typing).
> 2. If I have the actual patch on my machine (not in an e-mail
> message), I guess that I need something else (not git-am). Is there
> anything like that?
>
git apply patchfile
patch (-p1) < patchfile
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply
* Re: applying and committing patches in a single git command
From: Erez Zilber @ 2008-07-15 9:46 UTC (permalink / raw)
To: Boaz Harrosh, s-beyer; +Cc: git@vger.kernel.org
In-Reply-To: <487C659E.60606@panasas.com>
On Tue, Jul 15, 2008 at 11:53 AM, Boaz Harrosh <bharrosh@panasas.com> wrote:
> Erez Zilber wrote:
>> Hi,
>>
>> Someone created a patch with git-format-patch and sent it to me. I
>> would like to apply & commit the patch. If I use git-apply, it only
>> patches my tree without committing it. Now, I need to copy the commit
>> log, run git-commit and paste the commit log there. Is there a more
>> intelligent way to do that?
>>
>> Thanks,
>> Erez
>>
> git-am, can take all bunch of them at once
>
> Boaz
>
Thanks. I have 2 more questions:
1. How can I tell git-am to take a patch from an e-mail from a gmail account?
2. If I have the actual patch on my machine (not in an e-mail
message), I guess that I need something else (not git-am). Is there
anything like that?
Thanks,
Erez
^ permalink raw reply
* Re: What's cooking in git.git (topics)
From: Johannes Schindelin @ 2008-07-15 9:22 UTC (permalink / raw)
To: Geoffrey Irving; +Cc: Junio C Hamano, git
In-Reply-To: <7f9d599f0807142038w62ccb69fv42d6dcf3dd4f2afd@mail.gmail.com>
Hi,
On Mon, 14 Jul 2008, Geoffrey Irving wrote:
> The problem (beyond the basic problem of me not having tried running the
> tests) is that the current caching code isn't taking into account the
> changing values of diff_options. t6007 computes a patch-id for a commit
> with one value of options.paths, and then tries to compute a _different_
> patch-id for the same commit using a different value of options.paths.
>
> Here are a few different ways of fixing this:
>
> 1. Modify commit_patch_id in patch-ids.c to compute a sha1 of the
> diff_options structure and xor it with the commit sha1 to get a truly
> unique hash of the input. This means the optimization can be safely
> applied for all patch-id computations regardless of the diff_options.
> I can add a diff_options_sha1 function in diff.[ch] to compute the
> checksum.
>
> 2. Restrict commit_patch_id in patch-ids.c to apply the optimization
> only if options.nr_paths is zero, and perhaps a few other conditions.
> This is rather fragile, since it would mean that the cache would
> break if someone decided to change the default diff options.
Funnily, (2) contradicts (1). The patch id is _different_ when you have
nr_paths > 0. At least in the general case.
So what you propose in (1) will not work, unless you also hash the path
names (in the correct order, otherwise you'll end up with two hashes).
OTOH I would be really surprised if you needed --cherry-pick with paths
and/or diff options more than once for the same commits. So the caching
does not make sense to begin with (especially since we do not have a
proper way of gc'ing it, right?).
So I'd suggest saving diff_opts before the command line parsing, and
disable the cache when it is different _and/or_ (||) nr_paths.
Ciao,
Dscho
^ permalink raw reply
* Re: Closing the merge window for 1.6.0
From: Petr Baudis @ 2008-07-15 9:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nicolas Pitre, Gerrit Pape, Johannes Schindelin, git
In-Reply-To: <7v3amcgujd.fsf@gitster.siamese.dyndns.org>
On Mon, Jul 14, 2008 at 12:00:54PM -0700, Junio C Hamano wrote:
> But as the upstream, we have our own deprecation schedule. We should of
> course plan carefully not to harm existing users of our releases, but
> frankly speaking, 18 months since 1.4.4.4 was tagged (early January 2007)
> is an eternity in git timescale. Maybe we will slow down someday, and
> this 18-month is not a set-in-stone rule in any way, but at this point
> even without the packfile format issues, I personally think anything
> before 1.5.0 is irrelevant --- maybe they are interesting as historical
> curiosities, but not more than that.
Really, I think this is should be put into certain perspective:
(i) This change is special since it affects client-server
compatibility in bare repositories. AFAIK, none of the others
you mention does this.
(ii) The CRC checking is perhaps quite an improvement, but I
don't think it is critical-to-have-just-now.
(iii) Most importantly, this is not about waiting another few
years for Debian to catch up, since the next stable release
should really be upcoming rather soon:
http://debian-community.org/LennyReleaseSchedule/
(iv) These problems do not concern people who are currently
_actively_ _working_ with Git; these people hopefully do not
use 1.4 willingly and already use Git from backports.org.
This is about user experience for casual users who are quite
possibly interested only in read-only tracking of upstream
using Git - these people will likely use default Debian Git
version and that is okay, because frankly, for them, the
1.5 improvements do not really matter much. This is also
large class of prospective future real Git users and we might
not want to ruin Git's reputation in their eyes.
--
Petr "Pasky" Baudis
GNU, n. An animal of South Africa, which in its domesticated state
resembles a horse, a buffalo and a stag. In its wild condition it is
something like a thunderbolt, an earthquake and a cyclone. -- A. Pierce
^ permalink raw reply
* Re: Closing the merge window for 1.6.0
From: Petr Baudis @ 2008-07-15 9:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vtzesff91.fsf@gitster.siamese.dyndns.org>
On Mon, Jul 14, 2008 at 12:16:26PM -0700, Junio C Hamano wrote:
> Yeah, I think git-repack, git-gc, git-pack-objects and git-index-pack on
> the server side need a knob to tell it to stay conservative because the
> repository may be served over dumb protocols to avoid this problem.
>
> That knob could even be called
>
> [repack]
> usedeltabaseoffset = false
> [pack]
> indexversion = 1
Can you please mention this in release notes? Until now, I actually
thought you're speaking about a hypothetical improvement, not a knob we
actually have. :-) (BTW, turning off the usedeltabaseoffset is not
critical at least Debian-wise, and I think that really is the oldest Git
in widespread use.)
Now, there is of course still the issue of default behaviour, but at
least my concern is somewhat eased now. :-)
--
Petr "Pasky" Baudis
GNU, n. An animal of South Africa, which in its domesticated state
resembles a horse, a buffalo and a stag. In its wild condition it is
something like a thunderbolt, an earthquake and a cyclone. -- A. Pierce
^ permalink raw reply
* Re: applying and committing patches in a single git command
From: Boaz Harrosh @ 2008-07-15 8:53 UTC (permalink / raw)
To: Erez Zilber; +Cc: git@vger.kernel.org
In-Reply-To: <ce513bcc0807150150l783e9ff1kd7780dc59f4b5a3d@mail.gmail.com>
Erez Zilber wrote:
> Hi,
>
> Someone created a patch with git-format-patch and sent it to me. I
> would like to apply & commit the patch. If I use git-apply, it only
> patches my tree without committing it. Now, I need to copy the commit
> log, run git-commit and paste the commit log there. Is there a more
> intelligent way to do that?
>
> Thanks,
> Erez
>
git-am, can take all bunch of them at once
Boaz
^ permalink raw reply
* Re: applying and committing patches in a single git command
From: Stephan Beyer @ 2008-07-15 8:52 UTC (permalink / raw)
To: Erez Zilber; +Cc: git@vger.kernel.org
In-Reply-To: <ce513bcc0807150150l783e9ff1kd7780dc59f4b5a3d@mail.gmail.com>
Hi,
Erez Zilber wrote:
> Hi,
>
> Someone created a patch with git-format-patch and sent it to me. I
> would like to apply & commit the patch. If I use git-apply, it only
> patches my tree without committing it. Now, I need to copy the commit
> log, run git-commit and paste the commit log there. Is there a more
> intelligent way to do that?
git-am is exactly what you want.
Regards.
--
Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F
^ permalink raw reply
* applying and committing patches in a single git command
From: Erez Zilber @ 2008-07-15 8:50 UTC (permalink / raw)
To: git@vger.kernel.org
Hi,
Someone created a patch with git-format-patch and sent it to me. I
would like to apply & commit the patch. If I use git-apply, it only
patches my tree without committing it. Now, I need to copy the commit
log, run git-commit and paste the commit log there. Is there a more
intelligent way to do that?
Thanks,
Erez
^ permalink raw reply
* Re: [PATCH] bash completion: Fix the . -> .. revision range completion
From: Andreas Ericsson @ 2008-07-15 8:17 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Linus Torvalds, Junio C Hamano, Petr Baudis, git
In-Reply-To: <487C5B72.5040502@op5.se>
Andreas Ericsson wrote:
> Andreas Ericsson wrote:
>
> [ a whitespace damaged patch ]
>
> Sorry about that. I'll try again in a short while. It seems sending
> patches with thunderbird no longer works like it used to.
>
Apparently it wasn't ws-damaged after all. Just my font-settings
acting up on me.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply
* Re: [PATCH] bash completion: Fix the . -> .. revision range completion
From: Andreas Ericsson @ 2008-07-15 8:10 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Linus Torvalds, Junio C Hamano, Petr Baudis, git
In-Reply-To: <487C5A2D.3000707@op5.se>
Andreas Ericsson wrote:
[ a whitespace damaged patch ]
Sorry about that. I'll try again in a short while. It seems sending
patches with thunderbird no longer works like it used to.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply
* Re: [PATCH] bash completion: Fix the . -> .. revision range completion
From: Andreas Ericsson @ 2008-07-15 8:05 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Linus Torvalds, Junio C Hamano, Petr Baudis, git
In-Reply-To: <20080715042553.GD2432@spearce.org>
Shawn O. Pearce wrote:
> Linus Torvalds <torvalds@linux-foundation.org> wrote:
>> On Mon, 14 Jul 2008, Shawn O. Pearce wrote:
>>> What is $COMP_WORDBREAKS set to in your shell? In mine it
>>> appears to be:
>>>
>>> " \"'@><=;|&(:"
>> Ahhah. Indeed. I don't have the ':'.
> ...
>> Umm, if so, git should just set it in the completion script, no?
>
> OK, so it turns out not having : in COMP_WORDBREAKS is a very common
> case that we should somehow deal with, to aid our users.
>
> I'm concerned about just setting COMP_WORDBREAKS back to the default
> in the git completion script because then we get into an ordering
> game with the profile scripts, don't we? If git completion sources
> before the gvfs script we don't get our COMP_WORDBREAKS setting.
>
> I think we may need to do two things.
>
> If COMP_WORDBREAKS doesn't contain a :, try to reset it to include
> one when the script is sourced. This may "fix" git completion but
> make gvfs completion act differently, resulting in a thread on the
> gvfs lists. ;-)
>
> If COMP_WORDBREAKS doesn't contain : during a completion event than
> we need to do what your original patch asked, which is to include
> "$ref:" in the prefix, so the ref isn't lost.
>
> At least we understand the problem now, finally. I'll try to write
> up a patch for it tomorrow. Unfortunately packing to move has been
> really sucking up my time lately.
>
I beat you to it ;-) This works just fine for me regardless of whether
or not I have a colon in COMP_WORDBREAKS.
--%<--%<--%<--
From: Andreas Ericsson <ae@op5.se>
Subject: git-completion.bash: Handle "rev:path" completion properly
The gvfs package on at least Fedora9 installs its own bash
completion script which removes the colon from COMP_WORDBREAKS,
which acts as a list of characters where bash should consider
as word boundaries. Doing so breaks the git bash completion
script when handling any rev:path style argument.
This patch fixes it by prepending the "rev" part and the colon
(which otherwise gets lost) before adding the "path" part if
COMP_WORDBREAKS doesn't contain the colon we would otherwise
need.
Also fixes a nearby indented-with-spaces issue.
Spotted-by: Linus Torvalds <torvalds@linux-foundation.org>
Investigated-by: Björn Steinbrink <b.steinbrink@gmx.de>
Signed-off-by: Andreas Ericsson <ae@op5.se>
---
contrib/completion/git-completion.bash | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d268e6f..e138022 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -293,7 +293,11 @@ __git_complete_file ()
*)
ls="$ref"
;;
- esac
+ esac
+ # When completing something like 'rev:path', bash behaves
+ # differently whether or not COMP_WORDBREAKS contains a
+ # colon or not. This lets it handle both cases
+ test "${COMP_WORDBREAKS//:}" = "$COMP_WORDBREAKS" && pfx="$ref:$pfx"
COMPREPLY=($(compgen -P "$pfx" \
-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
| sed '/^100... blob /s,^.* ,,
--
1.5.6.3.315.g10ce0
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ 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