[git-users] Bash completion bug

2015-10-28 Thread Dmitry Kuzmenko
Bash remote branch name completion reports an error if working copy 
contains a directory with the same name as remote name.

Steps:

$ git remote
origin 
$ mkdir origin
$ git pull origin fatal: Not a git repository: 'origin' 

The problem is in the __gitdir() function. I've replaced it's complex logic 
with a simpler implementation that just let git to decide where is the git 
dir.
__gitdir ()
{
if [ "$1" ]; then
pushd "$1" >/dev/null
fi
# Current dir
git rev-parse --git-dir 2>/dev/null
if [ "$1" ]; then
popd >/dev/null
fi
}

It's not a fix because I didn't analyzed the code, just updated as I've 
suggested it should work and it works for me.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Re: Bash completion bug

2015-10-28 Thread Dmitry Kuzmenko
Just found the fix doesn't work. It should be fixed somewhere deeper in the 
logic

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] how to fecth a fil at specifick checksum ?

2015-10-28 Thread Konstantin Khomoutov
On Tue, 27 Oct 2015 17:47:18 -0700 (PDT)
Jorge V GM  wrote:

> I have this case:
> 
> a. I develop a html file in several days with daily commit
> b. some weeks after I noticed that I lost part of the code
> c. I located a code 3 commits ago.
> 
> then How I can fetch from the remote repository the html file as was
> 3 commit before ? (the whole file)

Use

  $ git show HEAD~3:path/to/that/file.html >localfile.html

This command:

1) Reads a commit which is the grand-grand-parent of the HEAD commit.
2) Extracts the contents of the file located at
   "path/to/that/file.html" in that commit and prints it to the standard
   output.
3) Since you want to actually save that contents, you use the shell
   stream redirection ">" to redirect the standard output of the `git`
   program to a file "localfile.html".

To solidify this knowledge, consider now reading the manual page
of the `git show` command and the `gitrevisions(7)` manual page which
will explain what "~N" means and which other nifty forms of
referring to revisions exist.  To read those manual pages, you can
run `git help show` and `git help revisions`.

As a last note, if you want to just *overwrite* your current HTML file
with its contents as recorded in that HEAD~3 commit, you can save typing
and use

  $ git checkout HEAD~3 path/to/local/file.html

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Re: Bash completion bug

2015-10-28 Thread Dmitry Kuzmenko
Another quick fix that looks working: added __git_refs variant which looks 
for refs only, not directory structure. Call it for git pull.

$ diff -u /usr/share/bash-completion/completions/git ~/tmp/git 
--- /usr/share/bash-completion/completions/git  2015-10-22 01:54:
32.0 +0300
+++ /home/dimm/tmp/git  2015-10-28 16:16:57.315415364 +0300
@@ -399,6 +399,28 @@
done   


  
 } 


  



 
+__git_refs_no_dir ()
+{
+   local i hash dir="$(__gitdir "${1-}")" track="${2-}"
+   local format refs
+   case "$cur" in
+   refs|refs/*)
+   git ls-remote "$dir" "$cur*" 2>/dev/null | \
+   while read -r hash i; do
+   case "$i" in
+   *^{}) ;;
+   *) echo "$i" ;;
+   esac
+   done
+   ;;
+   *)
+   echo "HEAD"
+   git for-each-ref --format="%(refname:short)" -- \
+   "refs/remotes/$dir/" 2>/dev/null | sed -e 
"s#^$dir/##"
+   ;;
+   esac
+}
+
 # __git_refs_remotes requires 1 argument (to pass to ls-remote)
 __git_refs_remotes ()
 {
@@ -586,7 +608,7 @@
;;
pull|remote)
if [ $lhs = 1 ]; then
-   __gitcomp_nl "$(__git_refs "$remote")" "$pfx" 
"$cur_"
+   __gitcomp_nl "$(__git_refs_no_dir "$remote")" 
"$pfx" "$cur_"
else
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
fi

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Git behind nginx reverse proxy

2015-10-28 Thread Péricé Robin


Hello everybody,

I want (if possible) to use git behind a nginx reverse proxy. This is my 
configuration.





I have 2 virtual machines. The first one host Nginx and the second host my 
Git repositories. I can access to git repositories usig Git VM dynamic ip 
(84.39.XX.XX), but it would be awesome if I can do *git clone* (etc ...) on* 
scm.domain.fr* instead of the dynamic-ip (of course I need this because I 
don't want everybody to know my Git VM ip...).

Is this possible with a Nginx reverse-proxy ?

Best regards,

Robin

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Git behind nginx reverse proxy

2015-10-28 Thread Konstantin Khomoutov
On Wed, 28 Oct 2015 09:20:41 -0700 (PDT)
Péricé Robin  wrote:

> I want (if possible) to use git behind a nginx reverse proxy. This is
> my configuration.
> 
> 
> 
> 
> 
> I have 2 virtual machines. The first one host Nginx and the second
> host my Git repositories. I can access to git repositories usig Git
> VM dynamic ip (84.39.XX.XX), but it would be awesome if I can do *git
> clone* (etc ...) on* scm.domain.fr* instead of the dynamic-ip (of
> course I need this because I don't want everybody to know my Git VM
> ip...).
> 
> Is this possible with a Nginx reverse-proxy ?

What protocol are you using when doing `git clone` from your Git VM?

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] does `git commit` modify $GIT_DIR/index?

2015-10-28 Thread Konstantin Khomoutov
On Tue, 27 Oct 2015 22:12:51 -0700 (PDT)
ozzloy  wrote:

> i am writing a script to test exactly what's staged for the next
> commit. this should work even on root commit, and in orphan branches,
> so using stash by itself doesn't work because there's no HEAD for
> stash to stash on.
> 
> my current solution in those situations is to:
> 0 commit the index
> 1 stash unstaged unignored files
> 2 run tests and save result
> 3 stash pop
> 4 delete HEAD
> 5 return the saved test result
> 
> my concern is that step 0 might modify the index.
> 
> if there's a better way to test the index, i'd be happy to hear it

I have one ide and one question.

The idea: use `git checkout-index` with a relocated work tree
(something like the result of running `mktemp -d /tmp/gitXX`)
and build there.  This will basically replace step 0 and remove
steps 1,3-5.  Basically, you'd do:

  DIR=`mktemp -d /tmp/gitXX`
  trap "rm -rf '$DIR'" TERM INT EXIT
  git --work-tree="$DIR" checkout-index --all
  make test -C "$DIR"

The question is: why are you concerned with the state of the file
representing the index at all?  As I've already hinted, the behaviour
of the index file during committing appears to be not documented which
means Git is free to actually update the index when it records a commit.
So what would maintaining the index's file mtime etc would buy you?

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.