threads / discuss / 25678

Rebase problems

Subject: Rebase problems

## tl;dr

5 messages between Nov 8, 2010 and Nov 12, 2010.

replies: 4people: 3as markdown or json

Maaartin· Nov 8, 2010, 18:19 UTC · lore

I'm using git for a project I'm working on alone (and I really like it), so I could rebase a lot, if I hadn't the following problems.

There's a file containing the timestamp which gets compiled in, so the executable can show it's version. Sometimes, I need to set it couple of times a day, sometimes only once a week. For each such timestamp I create a tag, so I can track it to the source easily. The timestamp is an important piece of information, so I put the containing file under version control. The downside is that I often get a conflict in this file halting my rebase. Is there a way how to ignore or automatically resolve all conflicts in this file (any resolution strategy is fine, as it will be overwritten anyway).

The second problem is problem of cygwin. While most of the operations git run in fractions of seconds, the most trivial rebase may take one minute or alike. Any idea what different things rebase do?

Wincent Colaiuta· Nov 8, 2010, 18:33 UTC · re: Maaartin · lore

Re: Rebase problems

On 08/11/2010, at 19:19, Maaartin wrote:
Show 11 quoted lines
> I'm using git for a project I'm working on alone (and I really like it), so I 
> could rebase a lot, if I hadn't the following problems.
> 
> There's a file containing the timestamp which gets compiled in, so the 
> executable can show it's version. Sometimes, I need to set it couple of times a 
> day, sometimes only once a week. For each such timestamp I create a tag, so I 
> can track it to the source easily. The timestamp is an important piece of 
> information, so I put the containing file under version control. The downside is 
> that I often get a conflict in this file halting my rebase. Is there a way how 
> to ignore or automatically resolve all conflicts in this file (any resolution 
> strategy is fine, as it will be overwritten anyway).
Rhetorical questions follow; no need for you to answer:
- Why is the timestamp an "important" piece of information?
- Have you considered that, for versioning purposes (ie. knowing _what_ source code was compiled to produce the product), the commit hash or the output of "git describe" may be much more useful than a disconnected timestamp?
- Regardless of whether you use a timestamp, a commit hash, or the output of "git describe", why can't it be inserted at compile time rather than stored in the repo?
- If you are really enamored of timestamps, would extracting the latest commit timestamp out of the repo be enough?
- Do these repeated merge conflicts set off "code smell" alarm bells for you (really, "process smell"), and make you suspect that there might be something wrong with what you are trying to do?

Cheers, Wincent

Maaartin-1· Nov 8, 2010, 19:59 UTC · re: Wincent Colaiuta · lore

Re: Rebase problems

On 10-11-08 19:33, Wincent Colaiuta wrote:
Show 15 quoted lines
> On 08/11/2010, at 19:19, Maaartin wrote:
> 
>> I'm using git for a project I'm working on alone (and I really like it), so I 
>> could rebase a lot, if I hadn't the following problems.
>>
>> There's a file containing the timestamp which gets compiled in, so the 
>> executable can show it's version. Sometimes, I need to set it couple of times a 
>> day, sometimes only once a week. For each such timestamp I create a tag, so I 
>> can track it to the source easily. The timestamp is an important piece of 
>> information, so I put the containing file under version control. The downside is 
>> that I often get a conflict in this file halting my rebase. Is there a way how 
>> to ignore or automatically resolve all conflicts in this file (any resolution 
>> strategy is fine, as it will be overwritten anyway).
> 
> Rhetorical questions follow; no need for you to answer:
However, I will. I've asked myself some of them already.
Addendum: It looks like your question were the right ones, the problem
seems to be solved now in a very easy way.
> - Why is the timestamp an "important" piece of information?

I need the timestamp (or something else) in order to match the problematic version to the source.

> - Have you considered that, for versioning purposes (ie. knowing _what_ source code was compiled to produce the product), the commit hash or the output of "git describe" may be much more useful than a disconnected timestamp?

Sure, I have considered it and I haven't ruled it out (I'm quite new to git). The timestamp is something the customer can understand better and has got used to during the past 5 yeas. It gets also stored in some database columns, whose type I had to change. Using tags I can relate the timestamp to the commit.

In any case I need to embed the information in the executable, which was impossible for a hash in a committed file. However, I don't want to commit it, anyway... so probably it's the way to go.

The output of git describe is quite unusable for this purpose, since the customer would happily drop the hash which can lead to ambiguities. Giving him only the SHA-1 would be safer.

> - Regardless of whether you use a timestamp, a commit hash, or the output of "git describe", why can't it be inserted at compile time rather than stored in the repo?

I could do it using an untracked file, which would eliminate my problem. The downside is that then--assuming using the timestamp--I'd have to rely on the tags or some logfile. No, there's no downside as I see after having read your next line.

> - If you are really enamored of timestamps, would extracting the latest commit timestamp out of the repo be enough?

Sure it would, I was mostly ignoring the commit timestamp until now, and didn't notice that I'm using a different timestamp for the executable without any reason. Now I need just trivial changes.

> - Do these repeated merge conflicts set off "code smell" alarm bells for you (really, "process smell"), and make you suspect that there might be something wrong with what you are trying to do?

Partly, starting using the timestamp was a huge improvement many years ago and I was quite happy with it until now. OTOH, git is new to me so I was thinking about changing what I'm doing with git or finding some new option there instead.

Now, I can have my timestamp and eat it, thank you.
Maaartin· Nov 12, 2010, 00:07 UTC · re: Maaartin-1 · lore

Re: Rebase problems

Maaartin-1 <grajcar1 <at> seznam.cz> writes:
> On 10-11-08 19:33, Wincent Colaiuta wrote:
> > - If you are really enamored of timestamps, would extracting the latest 
commit timestamp out of the repo be enough?
> 
> Sure it would, I was mostly ignoring the commit timestamp until now, and
> didn't notice that I'm using a different timestamp for the executable
> without any reason. Now I need just trivial changes.
Time to comment on myself:

It works nice, but there's a small problem. I can't take the author date since it gets preserved across rebases, so I could get non-unique dates. The committer date corresponds with the time I actually create the executable, and I really not going to produce more than one executable per second, so it works nicely. Except for rebase, which can create a lot of commits with the same committer date quickly.

Currently I'm using cygwin and rebase is slow like hell, but when I switch to Linux, I'll need something to ensure that there'll be no two commits with the same committer date. I think even a one second sleep could do for me, but can I arrange for it easily?

Andreas Schwab· Nov 8, 2010, 19:30 UTC · re: Maaartin · lore

Re: Rebase problems

Maaartin <grajcar1@seznam.cz> writes:
Show 8 quoted lines
> There's a file containing the timestamp which gets compiled in, so the 
> executable can show it's version. Sometimes, I need to set it couple of times a 
> day, sometimes only once a week. For each such timestamp I create a tag, so I 
> can track it to the source easily. The timestamp is an important piece of 
> information, so I put the containing file under version control. The downside is 
> that I often get a conflict in this file halting my rebase. Is there a way how 
> to ignore or automatically resolve all conflicts in this file (any resolution 
> strategy is fine, as it will be overwritten anyway).

If you already have a tag for every timestamp, why not autogenerate the timestamp from the tag?

Andreas.
-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

← back to recent threads