Fossil User Forum

Stuck on wrong branch
Login

Stuck on wrong branch

Stuck on wrong branch

(1) By Kirill M (Kirill) on 2024-11-23 20:45:23 [source]

Somehow both my Fossil checkouts ended up on the httpmsg-debug branch on the 735bd3dc check-in. Both have always been on trunk, with frequent runs of fossil update. I was puzzled that for a couple of weeks fossil update would report "Already up-to-date", until I noticed that I was on the wrong branch.

I'm curious how I could have ended up on that branch, though. The documentation for the update command say

The VERSION argument can be a specific version or tag or branch name. If the VERSION argument is omitted, then the leaf of the subtree that begins at the current version is used, if there is only a single leaf. VERSION can also be "current" to select the leaf of the current version or "latest" to select the most recent check-in.

I guess that I ended up on "the leaf of the subtree that begins at the current version", which was httpmsg-debug? This caught me off-guard.

(2) By Richard Hipp (drh) on 2024-11-23 21:00:12 in reply to 1 [link] [source]

See https://fossil-scm.org/home/ci_tags/28ea88e77039030f.

The first check-in of the httpmsg-debug branch was originally checked into trunk. But then I realized that I shouldn't be putting new features into a release candidate, so I move that check-in onto a branch. You probably did a "fossil update" while that check-in was still on trunk, then when I moved it off onto a branch, you got carried along with it. That happens sometimes.

You can always do "fossil up trunk" to make sure you have the latest trunk check-in.

I have been advocating for a web-based check-in process that does things like:

  • Allow you to preview the formatting of your check-in comment.

  • See a timeline-style graph of where in the tree the check-in is going.

  • See better web-based diffs.

If that capability had been available, you would have seen immediately that you were checking into a branch off of a branch and not a branch off of trunk, and could have aborted the check-in and done "fossil up trunk", retested, then done your "fossil commit --branch bv-infotool --ui" again. But, alas, we do not yet have a "--ui" option for "fossil commit".

(3) By Andy Bradford (andybradford) on 2024-11-23 21:19:43 in reply to 1 [link] [source]

> fossil update would report "Already up-to-date", until I noticed that
> I was on the wrong branch.

Yeah,  it's  possible  that  the   output  from  "fossil  update"  isn't
sufficient to  provide you  with proper  situational awareness.  It does
include the branch that you're on in "tags:"

tags:         trunk
changes:      None. Already up-to-date

But maybe people don't bother looking at all the output and only look at
the "changes:" line. In which case, maybe we should instead have changes
also include  a statement about  which branch  the changes were  on. For
example:

changes:      No changes on <branch>.  Already up-to-date

Then when  the branch changes,  and you think  you're on trunk  (or some
other branch), you  would recognize it immediately, instead  of a couple
of weeks later?


Andy

(4) By jvdh (veedeehjay) on 2024-11-23 22:04:44 in reply to 3 [link] [source]

this (unexpectedly not on trunk after some update) has only hit me once but it can indeed happen so more prominent notification of the user would be good in the CLI. since "tags" is maybe too generic (since it includes not only branch names) and comes before the "up to date" message, I think a final separate line after the "changes" line like

Current branch: trunk

(or "you are on branch xxx") might be preferable.

(5) By Andy Bradford (andybradford) on 2024-11-24 04:19:12 in reply to 4 [link] [source]

I opted to go with updating the  "changes:" line. I played with having a
separate line of output, but I think  I prefer the same line over having
yet another line of  output to deal with. I've committed  it to a branch
for now for  comments just in case  some object to changing  a line that
already exists.  I know that  we don't  make promises in  Fossil command
output but wanted to also discuss it.

https://www.fossil-scm.org/home/info/bb9150c403e78db3

Demonstration:

$ fossil status
repository:   /tmp/once.fossil
local-root:   /tmp/once/
config-db:    /home/amb/.fossil
checkout:     8555051cdd35046ba9c8d13bc39e2a07ad83b755 2024-11-24 03:57:15 UTC
parent:       ba98361edb8bc0c45ec479bec77ef9dc19cec671 2024-11-24 03:01:00 UTC
tags:         trunk
comment:      wait (user: amb)


In another clone  and working checkout I decide that  this commit should
be in a different branch:

$ fossil amend 8555051cdd35 --branch newfeature
hash:         8555051cdd35046ba9c8d13bc39e2a07ad83b755 2024-11-24 03:57:15 UTC
tags:         newfeature
comment:      wait (user: amb)


Now, when I update, it will show  me that there are no changes, but also
that the branch was renamed:

$ fossil update
Pull from file:///tmp/new.fossil
Round-trips: 2   Artifacts sent: 0  received: 1
Pull done, wire bytes sent: 701  received: 3086  remote: 
-------------------------------------------------------------------------------
checkout:     8555051cdd35046ba9c8d13bc39e2a07ad83b755 2024-11-24 03:57:15 UTC
tags:         newfeature
comment:      wait (user: amb)
changes:      None. Already up-to-date.  Branch changed from trunk to newfeature.

However, now  that I look at  the output, I'm  not sure I like  the fact
that it has to  wrap on a standard terminal size.  Clearly the length of
this also depends on the length  of branch names. This might indeed lend
itself more towards being on a separate line.


And again, if no changes, there is no additional output:

$ fossil update
Pull from file:///tmp/new.fossil
Round-trips: 1   Artifacts sent: 0  received: 0
Pull done, wire bytes sent: 331  received: 1490  remote: 
-------------------------------------------------------------------------------
checkout:     8555051cdd35046ba9c8d13bc39e2a07ad83b755 2024-11-24 03:57:15 UTC
tags:         newfeature
comment:      wait (user: amb)
changes:      None. Already up-to-date.

I didn't think  it would be good to always  output the "branch:" because
that information will almost always  likely be redundant given what's in
"tags:".

Perhaps conditionally output something like:

changes:      None. Already up-to-date.
achtung:      Branch changed from trunk to newfeature.

Something else?

Andy

(7) By Kirill M (Kirill) on 2024-11-24 20:03:35 in reply to 5 [link] [source]

I don't think any change in the output is necessary, really. The information is already there in the tags, it's up to the user to keep attention. But maybe adding some words in documentation/FAQ could perhaps be appropriate?

(8) By Andy Bradford (andybradford) on 2024-11-26 19:32:33 in reply to 7 [link] [source]

> I  don't think  any change  in the  output is  necessary, really.  The
> information is already there in the tags

Normally I  would agree that no  additional output is necessary,  but in
this  case it  comes up  often  enough that  I  think at  least a  small
change  is warranted.  Also, I  think  it even  surprises veteran  users
occasionally, so  this might help  minimize confusion. If they  miss the
additional output,  then I don't know  to say. My only  question at this
point is whether the information can be presented better?

I think  this is now  ready to  go in if  someone wants to  "review" it.
Basically it  will append "Branch changed  from X to Y."  if your update
switched branches and you did *not* provide a VERSION argument:

https://www.fossil-scm.org/home/timeline?r=show-branch-change

Andy

(10) By Stephan Beal (stephan) on 2024-11-26 19:37:28 in reply to 8 [link] [source]

Also, I think it even surprises veteran users occasionally,

🙋‍♂️

The first time it happened to me i assumed it was a horrible fossil bug. Once you've seen it, and understood why it happens, it's a no-brainer to avoid, but it's indeed surprising the first time one stumbles over it.

FWIW, i really like your src:2ef47b81 tweak. That's a nice idea.

(11) By Andy Bradford (andybradford) on 2024-11-26 19:55:53 in reply to 10 [link] [source]

> FWIW, i really like your src:2ef47b81 tweak. That's a nice idea.

Yeah, as I thought about it, I  didn't really want to see it everytime I
switched  branches and  I figured  that  most people  know what  they're
getting if they provide a 3rd argument.

Also, thanks for the demonstration---I  wondered how to do that src:HASH
trick. I knew it  could be done, but didn't want  to bother scouring the
source to figure it out.

I'll merge this later today (or tomorrow) if there are no objections.

Thanks,

Andy

(12) By Richard Hipp (drh) on 2024-11-26 20:12:41 in reply to 11 [link] [source]

The change you are wanting to commit appears to be just a warning that "fossil update" might leave you on the same check-in, but on a different branch, due to tags added by a third-party? Do I have that right?

That seems to be a reasonable step. But what if the branch name change happens just before the check-in occurs? What if the tag that moves the branch of the parent check-in arrives during the automatic "pull" that occurs at the beginning of the commit? Seems like it would still be easy for a person to get a check-in to the wrong branch without realizing it.

I was thinking that there might also be a check on the "commit" command such that if:

  1. The parent check-in has been the subject of a branch-change tag, and

  2. The user who issued the branch-change tag is different from the user doing the current check-in,

Then issue a warning message with a confirmation prompt, similar to the way we do now if there is an issue with line endings or a fork or a timestamp issue or other problem. Perhaps something like:

The parent check-in [abcd1234] was originally on branch 'trunk' but is now on branch 'new-feature'. Continue with the check-in? (Y/n)

(13.2) By Andy Bradford (andybradford) on 2024-11-26 21:21:59 edited from 13.1 in reply to 12 [link] [source]

> The change you are wanting to commit appears to be just a warning that
> "fossil  update" might  leave  you  on the  same  check-in,  but on  a
> different branch, due  to tags added by a third-party?  Do I have that
> right?

Yes, update  will update you to  the tip of whatever  current branch tag
you happen to be on, and if it changes you get additional output telling
you that this has happened. The intent was merely to keep the person who 
is running "fossil update" abreast of  a change that might impact future
work so there is less of a surprise later on.             

However, you also bring up some  other good points about what happens if
the tag changes  as part of an autosync while  committing. They will not
be  given the  opportunity  of correcting  or even  notice  that is  has
changed.

Before I merge this branch I'll look into your proposed idea that if the
tag  changes while  committing  that  it prompts  to  continue with  the
checkin. Right  now what it does  is automatically pull and  it does not
display any kind of warning (and  because the update command was not run
there is  no actual output  to show that  the branch changed).  The only
thing that might clue  me in is that while editing  my commit comment, I
might notice that suddenly the tags are different:

# Enter a commit message for this check-in. Lines beginning with # are ignored.
#
# user: amb
# tags: newbranch
#
# EDITED     file

I'll start looking at enhancing this.

Thanks for the idea.

Andy

(14) By Andy Bradford (andybradford) on 2024-11-27 19:56:00 in reply to 12 [link] [source]

> Then issue  a warning message  with a confirmation prompt,  similar to
> the way we do now if there is  an issue with line endings or a fork or
> a timestamp issue or other problem.

This is now implemented on the same branch:

https://www.fossil-scm.org/home/timeline?r=show-branch-change

Example:

$ fossil ci --no-prompt -m test
Pull from file:///tmp/master.fossil
Round-trips: 2   Artifacts sent: 0  received: 1
Pull done, wire bytes sent: 737  received: 3845  remote: 
parent check-in [c196dcaced] changed branch from 'trunk' to 'j'
Abandoning commit because branch has changed

It also works for interactive commits:

$ export EDITOR=ed
$ fossil ci
Pull from file:///tmp/master.fossil
Round-trips: 1   Artifacts sent: 0  received: 0
Pull done, wire bytes sent: 363  received: 1952  remote: 
ed ./ci-comment-CB666124B628.txt
131
1,$p
Prova.
# Enter a commit message for this check-in. Lines beginning with # are ignored.
#
# user: amb
# tags: l
#
# EDITED     file
1
Prova.
s/Prova/Prova Secondo/
w
139
q
Pull from file:///tmp/master.fossil
Round-trips: 2   Artifacts sent: 0  received: 1
Pull done, wire bytes sent: 739  received: 4079  remote: 
parent check-in [c196dcaced] changed branch from 'l' to 'm'
continue (y/N)? n
Abandoning commit because branch has changed


How does it look?

Andy

(15) By Florian Balmer (florian.balmer) on 2024-11-28 05:40:08 in reply to 14 [link] [source]

Does and/or should the --force option disable the prompt?

(I'm not sure, but I feel there should be a way to get stuff done by scripting, even if subsequent manual improvements may be necessary.)

(17) By Richard Hipp (drh) on 2024-11-28 12:08:54 in reply to 15 [link] [source]

I agree that --force should prevent the warning and continue prompt and just let the commit go through.

(19) By Andy Bradford (andybradford) on 2024-11-29 16:25:07 in reply to 15 [link] [source]

> Does and/or should the --force option disable the prompt?

It does now.  Thanks for the suggestion.

Andy

(16) By Richard Hipp (drh) on 2024-11-28 12:07:35 in reply to 14 [link] [source]

Thank you for the patch. However, I don't think it does quite what I had in mind.

A quick reading of your code suggests that it only issues the warning if the branch change was received during the autosync that happens at the start of the commit. I want it to detect a branch change that happens at any time prior to the commit. I suggest detecting that by searching for CONTROL artifacts that modify the branch of the primary parent check-in. You can do that using a query against the TAGXREF table. The conditions are:

  • There exists a TAGXREF entry that changes the branch of teh parent check-in.

  • That TAGXREF entry was originated from a user other than the user doing the current check-in.

The tricky bits will be detecting cases where the branch was changed multiple times, and figuring out the original branch of the parent check-in for use in the warning message. But it should all be doable with SQL - no need to parse artifacts, I don't think.

So, the branch change might have happened and have been synced days before the commit, and the committer might be fully aware of it. That's why this is a warning and not a fatal error. The user can always select "commit anyhow" in the case of a false positive.

(18) By Andy Bradford (andybradford) on 2024-11-29 16:14:11 in reply to 16 [link] [source]

> I want it to detect a branch change that happens at any time prior to
> the commit.

Alright, let me see if I can figure that out. Also for clarification, do
you also mean that  if I run "fossil status" after  a previous "pull" or
"sync" operation has brought in a branch name change that applies to the
working checkout,  that it will  also issue a  warning then? Or  is this
a "commit" warning only?


> So, the  branch change might have  happened and have been  synced days
> before the commit, and the committer might be fully aware of it.

If  the branch  change was  synced  days ago,  then the  "state" of  the
repository has already changed. To detect the change "now" at the moment
of "commit",  are you suggesting  looking at  the tagxref table  for the
latest branch tag that is "newer"  than the current working checkout and
issuing a warning then?

Thanks,

Andy

(20.2) By Andy Bradford (andybradford) on 2024-11-29 16:59:14 edited from 20.1 in reply to 18 [link] [source]

> looking at the tagxref table for the latest branch tag that is "newer"
> than the current working checkout and issuing a warning then?

Or does the  tagxref table get updated during a  sync/pull, and the very
presence  of an  entry in  that table  for the  current checkout  rid is
evidence that the branch has changed? [seems that's not quite the case]
[but I might be able to use srcid and origid]

In which case, all that is needed to be done is find out the branch name
*before* that change happened. You did mention sorting out if there were
multiple changes and finding the name *before* all of those changes.

Let me know if I'm on the wrong track.

Thanks,

Andy

(21) By Richard Hipp (drh) on 2024-11-29 23:58:00 in reply to 20.2 [link] [source]

You seem to be on the right trail. All of the auxiliary tables, including tagxref, are updated automatically whenever new artifacts are received, either by sync/pull or whatever other means. So it is sufficient to query the tagxref table, I believe.

To figure out the original name of the branch, look for the cancel tag on the symbol. For example, see the tags associated with the check-in that started this whole discussion:

https://fossil-scm.org/home/ci_tags/28ea88e77039030f

In this case, there is only a single tag, specifically artifact d75d757ce. That one artifact simultaneously does:

  1. Change the branch to httpmsg-debug
  2. Adds the symbolic name httpmsg-debug
  3. Changes the comment
  4. Drops the symbolic name httpmsg-debug

This results in four TAGXREF entries, which you can see using the following SQL:

SELECT tagxref.*, tag.tagname
  FROM blob, tagxref, tag
 WHERE blob.uuid GLOB '28ea88e77039*'
   AND tagxref.rid=blob.rid
   AND tag.tagid=tagxref.tagid;

Tag artifacts are processed in timestamp order. So if there are multiple branch changes on a single check-in, you can get the current branch name from the most recent change, and the original branch name from the cancel sym-* tag of the first change. On the other hand, I find zero instances of a check-in branch being changed more than once in either Fossil or SQLite, so I conclude that is an uncommon occurrence and so you shouldn't worry too much about it. If the warning message gets the wrong original branch name when the branch has been renamed multiple times, I think that will be ok, as long as it gets one of the prior branch names.

(22) By Andy Bradford (andybradford) on 2024-12-01 02:04:12 in reply to 21 [link] [source]

> To figure out the original name of the branch, look for the cancel tag
> on the symbol.

So it seems I  went a different direction in using  the tagxref table. I
wonder if it  would have been easier  to look for the cancel  tag as you
suggest.

This is what I've been testing:

https://www.fossil-scm.org/home/info/0aabb6bcacd627eb

Is this unncessarily complicated at this point? I'm not sure. Let me see
what it would take to instead use the cancel tag.

Thanks for the pointers.

Andy

(6) By brickviking on 2024-11-24 05:20:03 in reply to 3 [link] [source]

If you're using bash, there's a bash prompt function you could tailor for your needs. That's not much good outside of bash though. At least in my case, it slows down the initial prompt display on entering a checkout with a large number of changes. Sqlite3 and fossil-scm are both good examples of this, where on my machine, it can take a second to see the initial prompt. It seems to work perfectly well after that.

Here's an example of a bash prompt with changes against the checkin:

viking@host: (trunk) ~/src/c/fossil-scm/fossil $

The clean checkin would have cyan brackets instead, like this:

viking@host: (trunk) ~/src/c/fossil-scm/fossil $

There is other stuff you could do, of course - but that's about as complicated as I want to get.

RTDoc Brickviking
(Post 57)

(9) By Andy Bradford (andybradford) on 2024-11-26 19:33:45 in reply to 6 [link] [source]

> Here's an example of a bash prompt with changes against the checkin:

I'm not a  bash user, but I'll  admit that's a fun and  clever trick for
bash for those who are.

Andy

(23) By Vadim Goncharov (nuclight) on 2025-02-12 14:31:04 in reply to 9 [link] [source]

zsh also has VCS plugin, and I set this info to be in right prompt to not waste space on left.

(24) By Marcelo Huerta (richieadler) on 2025-02-12 20:57:26 in reply to 6 [link] [source]

One more cross-platform tool is Oh My Posh, which is available for Windows/MacOS/Linux and several shells (cmd, elvish, fish, nu, powershell, tcsh, xonsh, zsh), and whose configuration can be personalized modifying a YAML or JSON file. It doesn't come by default in any of the available themes, but it includes support for Fossil (it had a couple of problems, since solved, for which I raised a couple of issues quickly fixed).

It's useful to install fonts with specific glyphs (it includes a command to do precisely that) and it allows to personalize the prompts; I also added the LIZARD Unicode character to the corresponding prompt to represent Fossil. The default prompt, if you enable the Fossil segment, includes the branch and a summary of the status of files.

(25) By Kirill M (Kirill) on 2025-12-12 07:53:52 in reply to 1 [link] [source]

A year later this hits me again, and it takes two weeks for me to notice the tag which is even YELLING at me. When will I learn.

~/fossil $ fossil update                                                                    
Pull from https://fossil-scm.org/home
Round-trips: 1   Artifacts sent: 0  received: 0
Pull done, wire bytes sent: 356  received: 2812  remote: 194.195.208.62
-------------------------------------------------------------------------------
checkout:     8f509a5787c5b8cee692fa5df63a84b1ae9b16b2 2025-11-29 16:44:40 UTC
tags:         MISTAKE
comment:      Removed the list of candidate monospace fonts to allow the browser's default for
              "font-family: monospace" to take effect even if one of those fonts is installed. 
              This then removed the reason we collected all of the prior declarations, so scattered
              the one-off cases to be with the other definitions, but kept the generic cases
              together, if only so we can explain why we no longer have that long font list. (user:
              wyoung)
changes:      None. Already up-to-date.

(26) By Florian Balmer (florian.balmer) on 2025-12-12 14:48:56 in reply to 25 [link] [source]

From reading the source code changes, shouldn't the output, in your case, include:

Branch changed from trunk to MISTAKE.

But it doesn't? (Assuming your version of Fossil includes the linked changes.)

(27.2) By Andy Bradford (andybradford) on 2025-12-12 18:21:52 edited from 27.1 in reply to 26 [link] [source]

Kirill did say:

> and it takes two weeks for me to notice

That means that it would have emitted the warning two weeks ago, right?

With the changes you referenced  in the [show-branch-change] commits, it
would also  emit a  warning if  during a commit,  new changes  pulled in
during autosync cause  the branch to change, but I  don't know if that's
the  situation here.  [correction,  when attempting  to  commit and  the
branch changes it will actually halt]

My guess is that  this was simply a case where  the working checkout was
at  [8f509a5787] and  then  "fossil update"  was run  and  it emitted  a
warning about the branch change, but it went unnoticed.

(28) By Florian Balmer (florian.balmer) on 2025-12-12 15:49:16 in reply to 27.1 [link] [source]

Hm, somehow, I can't seem to reproduce in a scenario with two local clones to trigger the message, right now...

My guess is that ... it went unnoticed.

That's probably the reality with most warnings :-(

(29.1) By Andy Bradford (andybradford) on 2025-12-12 18:19:18 edited from 29.0 in reply to 28 [link] [source]

> I  can't seem  to reproduce  in a  scenario with  two local  clones to
> trigger the message

It's a rare  thing to have happen in practice,  and challenging to cause
to happen on demand, but here's one way:

$ cd /tmp
$ fossil new project.fossil
$ fossil clone project.fossil clone.fossil
$ mkdir project; mkdir clone
$ fossil open project.fossil --workdir project
$ cd project
$ echo $RANDOM >> file 
$ fossil add file
ADDED  file

$ fossil ci -m first 
New_Version: 157b3ce7963aafb39018c80be54dd537756c69e431a22e6db7e05ba376b41caa

$ fossil pull -R ../clone.fossil 
Pull from file:///tmp/project.fossil
Round-trips: 2   Artifacts sent: 0  received: 2
Pull done, wire bytes sent: 665  received: 941  remote: 

$ fossil open ../clone.fossil 157b3ce7963a --workdir ../clone
$ fossil amend 157b3ce7963a --branch trial
hash:         157b3ce7963aafb39018c80be54dd537756c69e4 2025-12-12 18:04:04 UTC
tags:         trial
comment:      first (user: amb)

$ cd ../clone
$ echo $RANDOM >> file
$ fossil ci -m whoa
Pull from file:///tmp/project.fossil
Round-trips: 2   Artifacts sent: 0  received: 1
Pull done, wire bytes sent: 733  received: 1016  remote: 
parent check-in [157b3ce796] branch changed from 'trunk' to 'trial'
continue (y/N)?

(32) By Florian Balmer (florian.balmer) on 2025-12-13 06:54:25 in reply to 29.1 [link] [source]

Ok, thanks for posting the example, this works.

However, fossil up doesn't show me the message after a manual fossil pull, i.e. if autosync is off.

Shouldn't the message also appear in this case? I mean, who -- except Richard -- is brave enough to have an open check-out of the Fossil main repository with autosync enabled? So the message will usually not appear in the very case it was designed for?

(33) By Andy Bradford (andybradford) on 2025-12-14 00:02:46 in reply to 32 [link] [source]

> However, fossil up doesn't show me the message

That's odd, further up in this  thread I demonstrated that very behavior
to be  working, but  now I'm  not able  to get  it to  work as  you have
pointed out. I wonder if the change that I was making got lost somewhere
with other changes that were introduced. I'll take a look.

(34) By Andy Bradford (andybradford) on 2025-12-14 00:48:38 in reply to 33 [link] [source]

> > However, fossil up doesn't show me the message
>
> That's  odd,  further up  in  this  thread  I demonstrated  that  very
> behavior to be working,

Correction. What I demonstrated is that if you run "fossil update" which
initiates an  autosync that it will  detect the branch change,  which it
still handles correctly:

$ fossil status | grep tags
tags:         trunk

$ fossil up
Pull from file:///tmp/project.fossil
Round-trips: 2   Artifacts sent: 0  received: 1
Pull done, wire bytes sent: 632  received: 1779  remote: 
-------------------------------------------------------------------------------
checkout:     d5347c4516ab5fa13fa923ac37a7300dcfced3bb 2025-12-14 00:11:16 UTC
tags:         rugpull
comment:      ancora (user: amb)
changes:      None. Already up-to-date.  Branch changed from trunk to rugpull.
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I don't  think I  ever considered  the scenario  where one  runs "fossil
pull" followed by a "fossil update". The trouble is that by the time you
run "fossil update" the branch state has already changed:

$ fossil status | grep tags
tags:         trunk

$ fossil pull
Pull from file:///tmp/project.fossil
Round-trips: 2   Artifacts sent: 0  received: 1
Pull done, wire bytes sent: 632  received: 1400  remote: 

$ fossil status | grep tags
tags:         switcheroo

Notice that the branch changed even before I ran update.

In  other words,  I believe  this would  have to  be emitted  during the
"fossil pull", not  during the "fossil update" for it  to work, where in
my opinion it might be even less  likely to be noticed, but maybe not if
it's output in such  a way as to be noticed. I almost  never look at the
"fossil pull" output  unless there's an error. Is this  a good place for
such information?

If  instead we  want to  have "fossil  update" be  responsible for  this
condition,  then I  think we'll  have to  introduce some  kind of  state
tracking of branch names, the  functionality for which doesn't currently
exist in the local checkout DB. Perhaps a new key/value pair in the vvar
table, for example, that could keep track of which branch it's on:

sqlite> SELECT * FROM vvar;
"checkout" "16"
"checkout-hash" "ee60d8dfc985a8295234fa52055b284457470cce603ed1a4a27579597206e7d3"

Perhaps a key of "checkout-branch" could be used to track it? Some other
mechanism?

(35) By Andy Bradford (andybradford) on 2025-12-14 00:58:34 in reply to 34 [link] [source]

> Perhaps a  key of "checkout-branch"  could be  used to track  it? Some
> other mechanism?

Of course the option to do nothing does still exist. :-)

(37) By Florian Balmer (florian.balmer) on 2025-12-15 08:25:43 in reply to 35 [link] [source]

It's nice that Fossils tries to be welcoming to newcomers. This is fine, sure, but sometimes, I think it can be a bit too much!

As soon as one or two users report a problem for the first time in 10 years, we throw in a tiny little feature to avoid their issue.

With all these tiny little features, the Fossil code base grows and grows and becomes more and more complex. And with the additional output generated by such tiny little features, there's more and more to digest on daily use of Fossil. Plus, new interactive prompts may break scripts.

In the case discussed in this topic, I think the tiny little feature is only half-baked, because it doesn't catch the case when autosync is off. Plus, we have at least one statement that the tiny little feature missed its point, because one user reported that they missed the output.

Fossil is a complex system, but Fossil users are certainly more savvy than the average computer user. And the Fossil web UI is an unbeatable tool to improve situational awareness and avoid issues as the one discussed here.

If I decided to learn using Git, I wouldn't expect the Git developers to throw in tiny little features for all my little aches.

Maybe the docs that provide fossil up as an example could be updated to always specify a branch name, or tip, or whatever, or a footnote could mention that tag changes could result in branch changes with the update command.

Perhaps a key of "checkout-branch" could be used to track it? Some other mechanism?

...

Of course the option to do nothing does still exist. :-)

Solutions for this case, in the order I prefer:

  • Remove the feature
  • Fix the feature to work with autosync set to off
  • Keep everything as it is

(38) By Daniel Dumitriu (danield) on 2025-12-15 10:45:33 in reply to 37 [link] [source]

While we are at it, we can also remove the tiny little features *** time skew *** server is..., and Would fork. "update" first or use --branch or "--allow-fork."

Fun and presentation issues aside, I think this is worthy - so let us fix it.

(39) By Kirill M (Kirill) on 2025-12-15 10:46:17 in reply to 37 [link] [source]

I am the one who reported the initial observation, but as I wrote earlier

I don't think any change in the output is necessary, really. The information is already there in the tags, it's up to the user to keep attention.

In my vote I would vote for removal rather than adding additional complexity.

(40) By Andy Bradford (andybradford) on 2025-12-15 15:00:40 in reply to 37 [link] [source]

> In the case  discussed in this topic, I think  the tiny little feature
> is only half-baked, because it doesn't catch the case when autosync is
> off.

To be  fair, autosync  mode is the  default and is  actually one  of the
stated primary  features of  Fossil[1] so those  running without  it are
already more "expert"  and should be more aware of  the gotchas involved
in running in this way. I also think discarding the "feature" is fine if
we just improve the documentation.

If the  consensus is  to remove  the "feature", then so be it.

[1] https://fossil-scm.org/home/doc/trunk/www/index.wiki #6

(41) By Andy Bradford (andybradford) on 2025-12-15 15:23:29 in reply to 34 [link] [source]

> Perhaps a  key of "checkout-branch"  could be  used to track  it? Some
> other mechanism?

Actually, it could just be done by  looking at the tagxref table. In the
case that it is decided to handle offline modes.

(30) By Kirill M (Kirill) on 2025-12-12 19:13:36 in reply to 27.2 [link] [source]

My guess is that this was simply a case where the working checkout was at [8f509a5787] and then "fossil update" was run and it emitted a warning about the branch change, but it went unnoticed.

Yup. I must say I don't pay too much attention to command output. I follow fossil-src mailings and periodically fossil update && time make, which are muscle memory. At some point I started wondering why update does not update, but it took a while before I noticed that branch had changed.

(31) By Martin Gagnon (mgagnon) on 2025-12-12 20:24:32 in reply to 30 [link] [source]

Perhaps using some fancy shell prompt like startship which has fossil plugin to show current branch in your prompt would help to notice this kind of thing..

I my case, I made a custom module that show even more informations about my fossil checkout.

Here an example:

~/fossil/fossil-scm on 🦎( softcoded-main-branch +18/-9 ±3 ?19 )   
❯ 
  • imagine it with some colors like the info from diff --numstat:
    • green for the +18
    • red for the -9
    • yellow for the ±3
    • I added the extras count in dark gray: ?19
    • Because there's local changes, softcoded-main-branch is in red.

Like if I'm on trunk and I have no local changes "trunk ✔" is in green:

~/fossil/fossil-scm on 🦎( trunk ✔  ?19 )   
❯ 

(36) By Marcelo Huerta (richieadler) on 2025-12-15 01:48:49 in reply to 31 [link] [source]

I find the information provided for Fossil by oh-my-posh to be more useful, and the configuration more accessible.