Confusing --graph --all output with detached branches

2016-05-19 Thread Bjørnar Snoksrud
If you end up with a history containing commit A with parent B, where
a detached branch is merged into A while an unrelated branch branches
off of B, you will get the following output:

$ git log --graph --all
*   commit ff4265fcbfe94a2abe93c97d86e0d9f0e0a136cb
|\  Merge: 8b62de9 0bbc311
| | Author: XXX
| | Date:   Thu May 19 15:31:46 2016 +0200
| |
| | Merge branch 'bar'
| |
| * commit 0bbc3115caa089d8578eb52ba6c12c1b43153dad
| | Author: XXX
| | Date:   Thu May 19 15:31:40 2016 +0200
| |
| | 5
| |
| * commit b1c9c491a05d9ffeca2e1d7b5cbd392cd90eef82
|   Author: XXX
|   Date:   Thu May 19 15:31:39 2016 +0200
|
|   4
|
| * commit ce053f92a9290f5472aac3319ddadbaf5bf62371
|/  Author: XXX
|   Date:   Thu May 19 15:31:31 2016 +0200
|
|   3
|
* commit 8b62de9f421c0be46300a3e68f85c6e7608c24f6
| Author: XXX
| Date:   Thu May 19 15:31:02 2016 +0200
|
| 2
|
* commit cb7e7e2662f1477f030a889cab135ed5a19ba43e
  Author: XXX
  Date:   Thu May 19 15:31:00 2016 +0200

  1

-

Which is pretty informative  - after '2' we branched out for commit 3,
and the branch containing 4 and 5 was merged into master.

However, if you use the pretty common `one line` git log alias, you get this:

*   ff4265f  (HEAD -> master) Merge branch 'bar'
|\
| * 0bbc311  (bar) 5
| * b1c9c49  4
| * ce053f9  (foo) 3
|/
* 8b62de9  2
* cb7e7e2  1

.. which indicates that `foo` is contained within `bar`. Maybe

*   ff4265f  (HEAD -> master) Merge branch 'bar'
|\
| * 0bbc311  (bar) 5
| * b1c9c49  4
|
| * ce053f9  (foo) 3
|/
* 8b62de9  2
* cb7e7e2  1

.. would be better?

Reproduction steps:

git init
git commit --allow-empty -m 1
git commit --allow-empty -m 2
git checkout --branch foo
git checkout -b foo
git commit --allow-empty -m 3
git checkout --orphan bar
git commit --allow-empty -m 4
git commit --allow-empty -m 5
git checkout master
git merge bar -m merge
git log --graph --all  --pretty=format:'%Cred%h %C(yellow)%-d%Creset %s '


-- 
bjor...@snoksrud.no
--
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


Minor bug with help.autocorrect.

2015-08-19 Thread Bjørnar Snoksrud
If you mis-type a git command starting with a non-letter, git
internals will spit out some errors at you.

$ git 5fetch
error: invalid key: pager.5fetch
error: invalid key: alias.5fetch
git: '5fetch' is not a git command. See 'git --help'.

Did you mean this?
fetch

$ git \#fetch
error: invalid key: pager.#fetch
error: invalid key: alias.#fetch
git: '#fetch' is not a git command. See 'git --help'.

Did you mean this?
fetch

-- 
bjor...@snoksrud.no
--
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


workdirs: cannot clone a local workdir directory

2015-07-15 Thread Bjørnar Snoksrud
I reported this before, but now I have a nice topic to hang it on -

I have re-reproduced the bug using a build from master as of today,
using the new worktree commands.

Reproduction:
Creating a repo `foo`, checkout --to'ing it to ../bar, then try to
clone both resulting repositories..

$ git --version
git version 2.4.4.600.g6397abd
$ mkdir foo
$ cd foo
$ git init
Initialized empty Git repository in /bar/foo/.git/
$ git commit -m init --allow-empty
[master (root-commit) c6da399] init
$ git branch bar
$ git checkout bar --to ../bar
Enter ../bar (identifier bar)
Switched to branch 'bar'
$ cd ../bar
$ cd bar
$ git status -sb
## bar
$ cd ..
$ git clone bar baz
Cloning into 'baz'...
fatal: '/path/bar' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ git clone foo baz
Cloning into 'baz'...
done.



-- 
bjor...@snoksrud.no
--
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


Linked workdirs break typo-correction.

2015-06-25 Thread Bjørnar Snoksrud
This is a weird one..

When standing in a folder inside a linked working copy, the
typo-correction breaks all commands.

Repro:
~/git $ git --version
git version 2.4.4.600.g6397abd
~/git $ git init bar
Initialized empty Git repository in ~/git/bar/.git/
~/git $ cd bar
~/git/bar (master #) $ git commit -m init --allow-empty
[master (root-commit) 554ea84] init
~/git/bar (master) $ mkdir folder
~/git/bar (master) $ touch folder/file
~/git/bar (master) $ git add folder
~/git/bar (master +) $ git commit -m folder
[master 8c00ba8] folder
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 folder/file
~/git/bar (master) $ cd folder/
~/git/bar/folder (master) $ git shw
WARNING: You called a Git command named 'shw', which does not exist.
Continuing under the assumption that you meant 'show'
in 0.1 seconds automatically...
commit 8c00ba8d30cff0e0d1b9cf110a65ea8f33edf8b2
Author: Bjørnar Snoksrud bsnok...@cisco.com
Date:   Thu Jun 25 16:08:01 2015 +0200

folder

diff --git a/folder/file b/folder/file
new file mode 100644
index 000..e69de29
bsnoksru@calculon ~/git/bar/folder (master) $ git branch foo
bsnoksru@calculon ~/git/bar/folder (master) $ git checkout foo --to
~/git/foo
Enter /home/bsnoksru/git/foo (identifier foo)
Switched to branch 'foo'
bsnoksru@calculon ~/git/bar/folder (master) $ cd ../../foo/folder/
~/git/foo/folder (foo) $ git shw
WARNING: You called a Git command named 'shw', which does not exist.
Continuing under the assumption that you meant 'show'
in 0.1 seconds automatically...
fatal: internal error: work tree has already been set
Current worktree: ~/git/foo
New worktree: ~/git/foo/folder
~/git/foo/folder (foo) $ git brnch baz
WARNING: You called a Git command named 'brnch', which does not exist.
Continuing under the assumption that you meant 'branch'
in 0.1 seconds automatically...
fatal: internal error: work tree has already been set
Current worktree: /home/bsnoksru/git/foo
New worktree: /home/bsnoksru/git/foo/folder


-- 
bjor...@snoksrud.no
--
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


Cannot clone a linked working directory.

2015-06-24 Thread Bjørnar Snoksrud
Summary:
When creating a linked working directory with `git checkout --to`, you
cannot clone from the local path. This works when cloning the main
repository directory.

I couldn't find anything the the documentation for `git checkout` that
indicates that this shouldn't work.

Repro:
Creating a repo `foo`, checkout --to'ing it to ../bar, then try to
clone both resulting repositories -

$ git --version
git version 2.4.4.600.g6397abd
$ mkdir foo
$ cd foo
$ git init
Initialized empty Git repository in /bar/foo/.git/
$ git commit -m init --allow-empty
[master (root-commit) c6da399] init
$ git branch bar
$ git checkout bar --to ../bar
Enter ../bar (identifier bar)
Switched to branch 'bar'
$ cd ../bar
$ cd bar
$ git status -sb
## bar
$ cd ..
$ git clone bar baz
Cloning into 'baz'...
fatal: '/path/bar' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ git clone foo baz
Cloning into 'baz'...
done.


-- 
bjor...@snoksrud.no
--
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