Re: [git-users] Visually show file history

2015-07-29 Thread Ying Huang

See my answer in context

On 7/29/15 8:10 AM, Konstantin Khomoutov wrote:

On Wed, 29 Jul 2015 07:48:10 -0700
Ying Huang huangyi...@gmail.com wrote:


Hi,
  great thanks for your attention,
  Yes,   git log --oneline --format %H --follow -- hello.txt is
better than using awk.

git log --oneline --format %H --follow -- hello.txt \
  | while read name; do
git difftool $name $name^1
  done

  Unfortunately, if you observe carefully, you will soon find that
*_it skipped some commits_*. I strongly doubt the fault is the ^ git
operator.
  My solution is using an array to save the output first: see my
script bellow:

I'm afraid I don't get your problem statement.
As I understood it, you told that,
1) say, let the history of hello.txt includes 3 commits, and
2) you'd like to see three diff views -- one for each of
those commits, and
3) each such diff view should display the changes between
the indicated commit and its parent commit.

Is that correct?

Yes, I want to see all 3 of them, each one diff against its parent.
Say, we have these 3 commits, just for easy:
commit1
commit2
commit3
I am expecting the following diff running:
git difftool commit1^! $1
git difftool commit2^! $1
git difftool commit3^! $1
While, only these two are running:
git difftool commit1^! $1
git difftool commit3^! $1
commit2 is not run. That's my problem, and I don't know why..




If yes, then if a commit has a name (its sha-1 hash sum) rev,
then the name of its first (or sole) parent commit is rev^1,
and the way to get a difference between them is by passing these
two arguments to a difftool.

Just in case (to remove the possibility of a certain common
misunderstanding), a diff view is always generated between a pair
of commits ignoring any commits which might naturally form a chain
between those commits in that pair.

Sure, I understand this.

--
Best Regards,

Ying

--
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] Visually show file history

2015-07-29 Thread Konstantin Khomoutov
On Wed, 29 Jul 2015 08:26:23 -0700
Ying Huang huangyi...@gmail.com wrote:

[...]
  I'm afraid I don't get your problem statement.
  As I understood it, you told that,
  1) say, let the history of hello.txt includes 3 commits, and
  2) you'd like to see three diff views -- one for each of
  those commits, and
  3) each such diff view should display the changes between
  the indicated commit and its parent commit.
 
  Is that correct?
  Yes, I want to see all 3 of them, each one diff against its
 parent.

OK, thanks.  At least the common ground is now established. :-)

 Say, we have these 3 commits, just for easy:
  commit1
  commit2
  commit3
  I am expecting the following diff running:
  git difftool commit1^! $1

Could you elaborate on why are you keep insisting on using rev^!
instead of rev^1 which, IMO, is a sensbile thing for this case?

From the gitrevisions(7) manual page:

| rev^!, e.g. HEAD^!
|  A suffix ^ followed by an exclamation mark is the same as
| giving commit rev and then all its parents prefixed with ^ to
| exclude them (and their ancestors).

That's clearly a thing from the commit set theory used when pruning
parts of the history DAG to get a smaller *set* of commits out of it.
Let me reinstate this logical chain: 1) A diff tool expects two
references to single commits; 2) rev^1 picks the first (left) or
the only parent -- always a single commit.
rev^! might potentially return any number of commits (bound only by
the total number of commits in your hisory graph); it this really what
you're looking for?  I'd question that.

  git difftool commit2^! $1
  git difftool commit3^! $1
  While, only these two are running:
  git difftool commit1^! $1
  git difftool commit3^! $1
  commit2 is not run. That's my problem, and I don't know
 why..

OK, one immediate thought is that your rev^! simply returns more than
a single entity and then one of the two possible things happen:
* All the list of revisions returned by that operator gets interpreted
  as a single string (according to the POSIX shell rules), and that
  string gets passed to your difftool which then fails to resolve such
  revision string into anything sensible.
* All that list gets passed to the difftool as separate arguments, but
  the tool gets confused about their number.

So...  Could you just freaking try the suggested

  git difftool commit2 commit2^1 $1

approach and see if that works?  Really, that would have saved a lot of
virtual trees already. ;-)

The next thing to try if that fails is to debug.  Do not call difftool,
but rather read up on `git rev-parse` and call it instead to see what
the difftool (or, rather, Git calling it) would think about what you
submit to it.  Make that printed to the console.  See what happens.

-- 
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] Visually show file history

2015-07-29 Thread Ying Huang

On 7/29/15 10:26 AM, Konstantin Khomoutov wrote:

On Wed, 29 Jul 2015 08:26:23 -0700
Ying Huang huangyi...@gmail.com wrote:

[...]

I'm afraid I don't get your problem statement.
As I understood it, you told that,
1) say, let the history of hello.txt includes 3 commits, and
2) you'd like to see three diff views -- one for each of
 those commits, and
3) each such diff view should display the changes between
 the indicated commit and its parent commit.

Is that correct?

  Yes, I want to see all 3 of them, each one diff against its
parent.

OK, thanks.  At least the common ground is now established. :-)


Say, we have these 3 commits, just for easy:
  commit1
  commit2
  commit3
  I am expecting the following diff running:
  git difftool commit1^! $1

Could you elaborate on why are you keep insisting on using rev^!
instead of rev^1 which, IMO, is a sensbile thing for this case?

 From the gitrevisions(7) manual page:

| rev^!, e.g. HEAD^!
|  A suffix ^ followed by an exclamation mark is the same as
| giving commit rev and then all its parents prefixed with ^ to
| exclude them (and their ancestors).

That's clearly a thing from the commit set theory used when pruning
parts of the history DAG to get a smaller *set* of commits out of it.
Let me reinstate this logical chain: 1) A diff tool expects two
references to single commits; 2) rev^1 picks the first (left) or
the only parent -- always a single commit.
rev^! might potentially return any number of commits (bound only by
the total number of commits in your hisory graph); it this really what
you're looking for?  I'd question that.


  git difftool commit2^! $1
  git difftool commit3^! $1
  While, only these two are running:
  git difftool commit1^! $1
  git difftool commit3^! $1
  commit2 is not run. That's my problem, and I don't know
why..

OK, one immediate thought is that your rev^! simply returns more than
a single entity and then one of the two possible things happen:
* All the list of revisions returned by that operator gets interpreted
   as a single string (according to the POSIX shell rules), and that
   string gets passed to your difftool which then fails to resolve such
   revision string into anything sensible.
* All that list gets passed to the difftool as separate arguments, but
   the tool gets confused about their number.

So...  Could you just freaking try the suggested

   git difftool commit2 commit2^1 $1

  I have changed to
git difftool $name^1 $name $1
But some commits are still skipped.


approach and see if that works?  Really, that would have saved a lot of
virtual trees already. ;-)

The next thing to try if that fails is to debug.  Do not call difftool,
but rather read up on `git rev-parse` and call it instead to see what
the difftool (or, rather, Git calling it) would think about what you
submit to it.  Make that printed to the console.  See what happens.

What does git rev-parse do? Will it harm my current git repository?
 I have read the man page but it raised more questions than 
answers.

Could you give me an example?
Currently I am using echo to see the commit, like bellowing:

git log --oneline --format=%H --follow -- $1 \
  | while read name; do
echo $name;git difftool $name^1 $name $1
done


--
Best Regards,

Ying

--
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] Putting an entire drive under version control?

2015-07-29 Thread 2015q3
I'm putting together a thumb drive that boots into an evil operating system 
(yes, that one), and has some applications and data on it. It would be nice 
to have the whole thing under version control. Yes, I know this is 
unconventional.

It seems to me that I might create a folder for this project, which would 
contain the repository, and a shortcut to the drive (/dev/sd*n*), and track 
the shortcut as a binary file. 

I'm new to VCS, but I know about the concept of filters for binary files. 
Is there one for ntfs? I don't think I would track changes to individual 
files, but rather track changes to sectors. 

Any help at all will be appreciated, even if you're just telling me that 
this is impossible or impractical.

-- 
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] Visually show file history

2015-07-29 Thread Ying Huang

Hi,
great thanks for your attention,
Yes,   git log --oneline --format %H --follow -- hello.txt is 
better than using awk.


git log --oneline --format %H --follow -- hello.txt \
| while read name; do
  git difftool $name $name^1
done

Unfortunately, if you observe carefully, you will soon find that 
*_it skipped some commits_*. I strongly doubt the fault is the ^ git 
operator.
My solution is using an array to save the output first: see my 
script bellow:


commits=( $(git log --oneline --format=%H --follow -- $1) )
for (( i=0; i${#commits[@]}; i++ )); do echo ${commits[i]};git difftool 
${commits[i]}^! $1; done



On 7/29/15 5:21 AM, Konstantin Khomoutov wrote:

On Tue, 28 Jul 2015 13:30:56 -0700
Ying Huang huangyi...@gmail.com wrote:


   Hi, I am trying to visually show a file change history.
   I have a file, named hello.txt, and 3 commits on it, they are:

_ 1b0e691e55caa8fd2b5dd6902f77c406fb68e648__
__ d058c095f7e98a7ebe943c18f87ef087c723bb9f__
__ c4d1769183ab6d852c624e71e6a0ca00dc3b6d13__
_
   Please note: they might not be continuous.
   The way to find all the commits on this file is by following
command: _git log --follow hello.txt|awk '/commit/{print $2}'_

This can be done without awk:

   git log --oneline --format %H --follow -- hello.txt


   Now, I want to show every visual diff of the 3, against their
respective parent.

   git difftool sha1 sha1^1

should do that, meaning run the configured difftool to show the
difference between the commit at sha1 and the commit which is the
first (left) or the sole parent of thatc commit.


   Let's take 1b0e691e55caa8fd2b5dd6902f77c406fb68e648 as example:
   The following command will give me a view on the commit details on
this file, and since I have configured kdiff3 as the difftool, so it
will pop up a kdiff3 windows to display the differences.
_ git difftool 1b0e691e55caa8fd2b5dd6902f77c406fb68e648^! hello.txt_
   So, I continue to use a while loop to try to see all the 3 commits
diff view
_ git log --follow hello.txt|awk '/commit/{print $2}'|while read ss;
do git difftool $ss^! hello.txt; done_

OK, so I'd rephrase this like

   git log --oneline --format %H --follow -- hello.txt \
 | while read name; do
   git difftool $name $name^1
 done

Please read the gitrevisions manual page on that rev^n notation
(run `git help revisions`).


--
Best Regards,

Ying

--
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] Visually show file history

2015-07-29 Thread Konstantin Khomoutov
On Wed, 29 Jul 2015 07:48:10 -0700
Ying Huang huangyi...@gmail.com wrote:

 Hi,
  great thanks for your attention,
  Yes,   git log --oneline --format %H --follow -- hello.txt is 
 better than using awk.
 
 git log --oneline --format %H --follow -- hello.txt \
  | while read name; do
git difftool $name $name^1
  done
 
  Unfortunately, if you observe carefully, you will soon find that 
 *_it skipped some commits_*. I strongly doubt the fault is the ^ git 
 operator.
  My solution is using an array to save the output first: see my 
 script bellow:

I'm afraid I don't get your problem statement.
As I understood it, you told that,
1) say, let the history of hello.txt includes 3 commits, and
2) you'd like to see three diff views -- one for each of
   those commits, and
3) each such diff view should display the changes between
   the indicated commit and its parent commit.

Is that correct?

If yes, then if a commit has a name (its sha-1 hash sum) rev,
then the name of its first (or sole) parent commit is rev^1,
and the way to get a difference between them is by passing these
two arguments to a difftool.

Just in case (to remove the possibility of a certain common
misunderstanding), a diff view is always generated between a pair
of commits ignoring any commits which might naturally form a chain
between those commits in that pair.

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