git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rod <armyofthepenguin@gmail.com>
To: git@vger.kernel.org
Subject: A git problem with timestamps
Date: Sun, 7 Sep 2008 09:54:02 -0400	[thread overview]
Message-ID: <200809070954.03394.armyofthepenguin@gmail.com> (raw)

I have a problem with a git repository that I'm hoping you folks can help me 
with. 

If you folks have the time here's my situation:
============================
2 persons developing together (Fred and Barney if you will). Fred's repository 
is the canonical repository, Barney cloned from Fred, and periodically has 
Fred pull Barney's work, and if it passes muster, merge it into Fred's 
master. Barney is good about pulling Fred's master into his own master 
periodically and basing his work off the master branch.

Fred starts with source code that is not his own (or under version control), 
but that he needs to clean up with help from Barney.

Now Fred is a conscientious Linux user and uses ntp to make sure his system 
date is in sync within a couple of milliseconds of UTC. Barney (that would be 
me) is a slacker too lazy to run ntpclient, or ntpd to make sure he's also 
in sync with UTC. In point of fact, Barney's clock says he's 6 hours earlier 
than Fred (i.e., when Fred's system clock say it's 6 p.m., Barney's clock say 
it's noon.).

Git has no problem keeping track of the order in which commits occurs as gitk 
clearly shows. But git log has a problem since it's ordering by time stamps, 
so it shows Fred's initial commit occurring *After* some commits pulled from 
Barney's repository. 

What's really bugging Fred and Barney is that Fred has received a new updated 
version of the original source code he was tasked to clean up. What Fred and 
Barney would like to do is to make a branch of the repository from the base 
of master, and then apply the history of master onto this branch. For 
personal reasons, they don't want to simply rebase master off this branch.

To be a little more specific, what Fred and  Barney would like to do is to 
branch master's base node (not HEAD), call it "updated_original_source_code", 
unroll the "updated" original source code in this branch, commit the diffs 
from the original source code to "updated" original source code, and then 
apply the history of master by using git-format-patch and git-am to generate 
a sequence of patches to apply onto updated_original_source_code branch. 

The problem is that the patches generated by git-format-patch are generated by 
timestamp, and since slacker Barney's timestamps are off by 6 hours, some of 
the patches would be applied in the wrong order thus borking the operation. 
Have you any suggestions for how to get around this problem? I'm sure I can't 
be the only person to have used the wrong system clock time.

Here are the git commands Fred is attempting to use:
# Branch the *base* of master
git checkout -b updated_original_source_code 345678

cp ../updated_source_code.tar.gz .
tar zxvf updated_source_code.tar.gz

# Commit all changes from original_source_code
# to updated_source_code
git -a -m "Updated original source code"

# Now apply the history of master onto this branch:
# This is where they get hosed because the timestamps
# from Barney's commits are wrong, and hence the 
# generated patches are out of order.
git format-patch 345678..master | git am -k -3

--Rod

P.s. Would a diagram help?

             reply	other threads:[~2008-09-07 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-07 13:54 Rod [this message]
2008-09-07 20:03 ` A git problem with timestamps 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200809070954.03394.armyofthepenguin@gmail.com \
    --to=armyofthepenguin@gmail.com \
    --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.
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 NNTP newsgroup(s).