From: Todd Lewis <utoddl@email.unc.edu>
To: git@vger.kernel.org
Subject: bug report: dates on diff
Date: Thu, 6 Jul 2017 08:54:14 -0400 [thread overview]
Message-ID: <b28bc109-b06f-0acf-960b-0b6761b0ee38@email.unc.edu> (raw)
I've run into what I think is a bug wrt date handling in "git diff". I have some
historical data with which I'm attempting to populate a new git repo with
back-dated commits. That appears to work. But referencing those commits by date
with "git diff" does not. (I have no idea if the problem is limited to "git
diff"; that's just where I've been banging my head.)
I'm using git version 2.9.4.
Below is a recreation of the problem from scratch using made up data. Note that
the "git log" output shows the commits with the correct dates, but referencing
"master@{any-date-before-git-init}" throws a "Warning: Log for 'master' only
goes back to ..." and it erroneously selects the first commit (for 2010 in the
example below, instead of the requested 2012 commit).
Here's the terminal session demonstrating the problem:
[utoddl@tarna tmp]$ mkdir gitbug
[utoddl@tarna tmp]$ cd gitbug
[utoddl@tarna gitbug]$ git init
Initialized empty Git repository in /tmp/gitbug/.git/
[utoddl@tarna gitbug]$ for year in 2010 2011 2012 2013 2014 ; do
> echo "Charter for year $year." > charter_01-01-$year.txt
> touch -d"$year-01-01" charter_01-01-$year.txt
> done
[utoddl@tarna gitbug]$ ls -al
total 20
drwxrwxr-x. 3 utoddl utoddl 160 Jul 6 08:14 .
drwxrwxrwt. 19 root root 420 Jul 6 08:12 ..
-rw-rw-r--. 1 utoddl utoddl 23 Jan 1 2010 charter_01-01-2010.txt
-rw-rw-r--. 1 utoddl utoddl 23 Jan 1 2011 charter_01-01-2011.txt
-rw-rw-r--. 1 utoddl utoddl 23 Jan 1 2012 charter_01-01-2012.txt
-rw-rw-r--. 1 utoddl utoddl 23 Jan 1 2013 charter_01-01-2013.txt
-rw-rw-r--. 1 utoddl utoddl 23 Jan 1 2014 charter_01-01-2014.txt
drwxrwxr-x. 7 utoddl utoddl 200 Jul 6 08:12 .git
[utoddl@tarna gitbug]$ for year in 2010 2011 2012 2013 2014 ; do
> cp -p charter_01-01-$year.txt charter.txt
> git add charter.txt
> git commit --date="01-01-$year" -m "Committing charter for $year." charter.txt
> done
[master (root-commit) f5dc22c] Committing charter for 2010.
Date: Fri Jan 1 07:19:45 2010 -0500
1 file changed, 1 insertion(+)
create mode 100644 charter.txt
cp: overwrite 'charter.txt'? y
[master dec8944] Committing charter for 2011.
Date: Sat Jan 1 07:19:47 2011 -0500
1 file changed, 1 insertion(+), 1 deletion(-)
cp: overwrite 'charter.txt'? y
[master cab72e0] Committing charter for 2012.
Date: Sun Jan 1 07:19:48 2012 -0500
1 file changed, 1 insertion(+), 1 deletion(-)
cp: overwrite 'charter.txt'? y
[master a0cbf74] Committing charter for 2013.
Date: Tue Jan 1 07:19:49 2013 -0500
1 file changed, 1 insertion(+), 1 deletion(-)
cp: overwrite 'charter.txt'? y
[master a75164c] Committing charter for 2014.
Date: Wed Jan 1 07:19:53 2014 -0500
1 file changed, 1 insertion(+), 1 deletion(-)
[utoddl@tarna gitbug]$ git log
commit a75164cdf56b5f7b10e7575ee4aa4f653656e456
Author: Todd Lewis <utoddl@email.unc.edu>
Date: Wed Jan 1 07:19:53 2014 -0500
Committing charter for 2014.
commit a0cbf74320f5b2309f697a48a8026328a998d787
Author: Todd Lewis <utoddl@email.unc.edu>
Date: Tue Jan 1 07:19:49 2013 -0500
Committing charter for 2013.
commit cab72e0902cb4130de49c5d898ef4cc2daf1e2d1
Author: Todd Lewis <utoddl@email.unc.edu>
Date: Sun Jan 1 07:19:48 2012 -0500
Committing charter for 2012.
commit dec8944f3c411f5f667cdfefee0609d38298489f
Author: Todd Lewis <utoddl@email.unc.edu>
Date: Sat Jan 1 07:19:47 2011 -0500
Committing charter for 2011.
commit f5dc22c636dd66a51e74dc01935a4879bd4946d6
Author: Todd Lewis <utoddl@email.unc.edu>
Date: Fri Jan 1 07:19:45 2010 -0500
Committing charter for 2010.
[utoddl@tarna gitbug]$ git diff master@{01-01-2012} charter.txt
warning: Log for 'master' only goes back to Thu, 6 Jul 2017 08:19:45 -0400.
diff --git a/charter.txt b/charter.txt
index a18dbc9..29fedf9 100644
--- a/charter.txt
+++ b/charter.txt
@@ -1 +1 @@
-Charter for year 2010.
+Charter for year 2014.
[utoddl@tarna gitbug]$
--
+--------------------------------------------------------------+
/ Todd_Lewis@unc.edu 919-445-0091 http://www.unc.edu/~utoddl /
/ A man's home is his castle, in a manor of speaking. /
+--------------------------------------------------------------+
next reply other threads:[~2017-07-06 12:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-06 12:54 Todd Lewis [this message]
2017-07-06 16:22 ` bug report: dates on diff Junio C Hamano
2017-07-06 17:32 ` Todd Lewis
2017-07-06 18:03 ` Junio C Hamano
2017-07-06 18:05 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b28bc109-b06f-0acf-960b-0b6761b0ee38@email.unc.edu \
--to=utoddl@email.unc.edu \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).