Re: Feature request: Please add support to stash specific files

2017-06-06 Thread Christian Neukirchen
rajdeep mondal <justrajd...@gmail.com> writes:

> git version 2.6.3
> OS: RHEL 6
>
> Work around found in:
> https://stackoverflow.com/questions/3040833/stash-only-one-file-out-of-multiple-files-that-have-changed-with-git
>
> Workaround is not very optimal. Please add this support to git.

This has been implemented in Git 2.13:

> * "git stash push" takes a pathspec so that the local changes can be
>   stashed away only partially.

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org



Re: Stable GnuPG interface, git should use GPGME

2017-03-13 Thread Christian Neukirchen
"brian m. carlson" <sand...@crustytoothpaste.net> writes:

> Because the amount of the gpg API we actually use is very small, a user
> who wants to use a custom signature program (say, OpenBSD's signify),
> can actually write a simple wrapper that mimics it and use that instead.

FWIW, I did this, and it was quite some effort to figure out the
actual API that is needed:

http://chneukirchen.org/dotfiles/bin/git-signify

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org



Re: git shortlog vs. stdin

2016-11-15 Thread Christian Neukirchen
Andreas Krey <a.k...@gmx.de> writes:

> Bug or feature?

Documented feature, but you're holding it wrong ;)

   If no revisions are passed on the command line and either standard
   input is not a terminal or there is no current branch, git shortlog
   will output a summary of the log read from standard input, without
   reference to the current repository.

(Note that you can use shortlog ala "git log --pretty=short | git shortlog")

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org



Re: git commit -p with file arguments

2016-10-05 Thread Christian Neukirchen
Duy Nguyen <pclo...@gmail.com> writes:

>> At the least I think we should clarify this in the document.
>
> How about something like this? Would it help?

I think it captures the current behavior well.

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org


Re: git commit -p with file arguments

2016-09-09 Thread Christian Neukirchen
Jakub Narębski <jna...@gmail.com> writes:

> Which means that with "git add -p  && git commit ",
> the "git add -p " would carefully craft the  state
> in the index... and "git commit " would take worktree version
> of  for commit, ignoring what was in the index :-(
>
> Currently there is no way to create commit out of subset of the index,
> e.g. with "git commit :0:"

I played around with creating a new index just for "add -p" and then
committing that one.  Seems to have worked...

Perhaps I'll just wrap git-commit myself then.

cu,
-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org



Re: git commit -p with file arguments

2016-09-09 Thread Christian Neukirchen
Jacob Keller <jacob.kel...@gmail.com> writes:

> It wants to commit bar too because you already added bar before. It works 
> like:
>
> "git add bar && git add -p foo && git commit" does it not?
>
> I fail to see why "git commit -p " would unstage the bar you
> already added? Or am I missing some assumption here?

Yet the commit message comment says:
# Explicit paths specified without -i or -o; assuming --only paths...

But files are committed which were not given on the command line.

My confusion is that I use "git commit" with explicit files, yet other
files are committed.  AFAICS, this only happens with -p.

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org



git commit -p with file arguments

2016-09-05 Thread Christian Neukirchen
Hi,

I noticed the following suprising behavior:

% git --version
git version 2.10.0

% git add bar
% git status -s 
A  bar
 M foo

% git commit -p foo
[stage a hunk]
...
# Explicit paths specified without -i or -o; assuming --only paths...
# On branch master
# Changes to be committed:
#   new file:   bar
#   modified:   foo
#

So why does it want to commit bar too, when I explicitly wanted to
commit foo only?

This is not how "git commit files..." works, and the man page says

3.by listing files as arguments to the commit command, in which
   case the commit will ignore changes staged in the index, and
   instead record the current content of the listed files (which must
   already be known to Git);

I'd expect "git commit -p files..." to work like
"git add -p files... && git commit files...".

Thanks,
-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org



Re: git add -p—splitting hunks, limit is too large

2016-09-02 Thread Christian Neukirchen
Jeff King <p...@peff.net> writes:

> Splitting to single lines means you need to remember to add the matched
> pairs, which might be arbitrarily far apart.  That's not really any
> different than dumping the hunk in your editor, but I find there that
> it's easy to rearrange and group things as appropriate.

My main use case for this would be to split a plain addition into
several small additions.  Which would be much easier with the
menu-driven approach.

(Mostly I just use magit, but sometimes I want to do this on machines
without emacs set up.)

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org



Re: git add without whitespace

2016-05-31 Thread Christian Neukirchen
Junio C Hamano <gits...@pobox.com> writes:

> Robert Dailey <rcdailey.li...@gmail.com> writes:
>
>> $ git diff -U0 -w --no-color | git apply --cached --ignore-whitespace
>> --unidiff-zero
>>
>> This command explicitly leaves out context because it can sometimes
>> cause the patch to fail to apply, I think due to whitespace being in
>> it, but I'm not completely sure myself.
>
> I have had this in my ~/.gitconfig for a long time.
>
> [alias]
>   wsadd = "!sh -c 'git diff -- \"$@\" | git apply --cached 
> --whitespace=fix;\
>   git co -- ${1-.} \"$@\"' -"

Very useful, thanks for sharing!

I wonder which other gems are in your .gitconfig, is it public?

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org

--
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] rebase -i: add ack action

2016-04-11 Thread Christian Neukirchen
Johannes Schindelin <johannes.schinde...@gmx.de> writes:

> How about making it easier to use, and much, much more generic, like this?
>
> 1. introducing an `--add-footer` flag to `git commit` that you could use
> like this:
>
>   git commit --amend --add-footer "Acked-by: Bugs Bunny"

I have a script where I currently do this ala:

GIT_EDITOR="git -c trailer.closes.ifExists=replace interpret-trailers \
--trailer 'Closes: #$PR [via git-merge-pr]' --in-place" \
git commit --quiet --amend

But I think it could be a good addition to porcelain.
(interpret-trailers still feels hard to drive by a script...)

-- 
Christian Neukirchen  <chneukirc...@gmail.com>  http://chneukirchen.org

--
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] cvsimport: silence regex warning appearing in Perl 5.22.

2015-06-24 Thread Christian Neukirchen
Since Perl 5.22, A literal '{' should now be escaped in a pattern.
Silence the recently added warning by using \{ instead.

Signed-off-by: Christian Neukirchen chneukirc...@gmail.com
---
 git-cvsimport.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 73d367c..8a68777 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -921,7 +921,7 @@ sub commit {
# (See check_refname_component in refs.c.)
1 while $xtag =~ s/
(?: \.\.# Tag cannot contain '..'.
-   |   \@{ # Tag cannot contain '@{'.
+   |   \@\{# Tag cannot contain '@{'.
| ^ -   # Tag cannot begin with '-'.
|   \.lock $# Tag cannot end with '.lock'.
| ^ \.  # Tag cannot begin...
-- 
2.4.4

--
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: Redirect git subcommand to itself?

2015-05-29 Thread Christian Neukirchen
Junio C Hamano gits...@pobox.com writes:

  * You can help yourself with something like this, I suppose:

[alias]
   git = !sh -c 'exec git \$@\' -

but I personally feel that it is too ugly to live as part of our
official suggestion, so please do not send a patch to add it as
a built-in alias ;-).

So I thought I was clever, but this didn't work:

% ln -s /usr/bin/git ~/bin/git-git  
% git git
fatal: cannot handle git as a builtin

-- 
Christian Neukirchen  chneukirc...@gmail.com  http://chneukirchen.org

--
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: Redirect git subcommand to itself?

2015-05-29 Thread Christian Neukirchen
Junio C Hamano gits...@pobox.com writes:

 Christian Neukirchen chneukirc...@gmail.com writes:

 Junio C Hamano gits...@pobox.com writes:

  * You can help yourself with something like this, I suppose:

[alias]
 git = !sh -c 'exec git \$@\' -

but I personally feel that it is too ugly to live as part of our
official suggestion, so please do not send a patch to add it as
a built-in alias ;-).

 So I thought I was clever, but this didn't work:

 % ln -s /usr/bin/git ~/bin/git-git  
 % git git
 fatal: cannot handle git as a builtin

 Why did you have to do that when I already gave an alias that works?

I was just toying around, and it would have been cute.

 Or didn't the alias work?

It does.  This seems to work just as well, and is easier:

git = !git

Thanks,
-- 
Christian Neukirchen  chneukirc...@gmail.com  http://chneukirchen.org
--
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: [ANNOUNCE] Git v2.3.0-rc0

2015-01-14 Thread Christian Neukirchen
Junio C Hamano gits...@pobox.com writes:

  * git push into a repository with a working tree normally refuses
to modify the branch that is checked out.  The command learned to
optionally do an equivalent of git reset --hard only when there
is no change to the working tree and the index instead, which would
be useful to deploy by pushing into a repository.

Perhaps this can mention receive.denyCurrentBranch=updateInstead so
interested users won't have to grep the tree for 10min to find it. :)

Thanks,
-- 
Christian Neukirchen  chneukirc...@gmail.com  http://chneukirchen.org

--
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: Question about rerere

2014-11-06 Thread Christian Neukirchen
Tristan Roussel trous...@phare.normalesup.org writes:

 Hello,

 I’ve just learnt about rerere and it’s going to make my life so much
 easier, I have a question though.

 I enabled rerere very lately and I wanted to know if there was a way
 to feed rerere with old merge conflict resolutions (and if not, would
 it be considered a good feature request)? I’d like to do a rebase of
 my work because I unintentionally merged a branch I didn’t want and
 the merge is a bit far in the git history and I don’t want to
 re-resolve merge conflicts I had after that.

Have a look at contrib/rerere-train.sh.

(Which I learned from
http://git-blame.blogspot.de/2012/04/rebuilding-git-integration-environment.html)

Ciao,
-- 
Christian Neukirchen  chneukirc...@gmail.com  http://chneukirchen.org

--
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