Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

sonic bed head posted:

I am pretty sure that your understanding of what svn:ignore does is incorrect. svn:ignore has nothing to do with the repository/server. It is just a setting that tells the client to ignore that directory when updating/committing.
Incorrect. Subversion always notices changes to its versioned objects. If something is in the repository, the svn:ignore property doesn't do a drat thing. It only tells the client to ignore new, unversioned objects that have been created.

I can't guess what's happening with epswing, though.

Adbot
ADBOT LOVES YOU

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Kekekela posted:

Cool, thanks. That being the case, why do I have to do the "Update" in step 2?
See the section of the Subversion book about mixed revision working copies, specifically that a directory must be fully up-to-date before you can commit property changes to it.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
I have a question about version numbers as they relate to version control.

At the company where I recently worked, the version number of a software package was stored in a file that's part of the project. The checked-in version number string usually ended in "-dev", like "1.4.0-dev", for development builds of the software. Release candidates had version strings like "1.4.0-rc3".

The company made hardware devices as well as the software to run them, so it was common for developers to test changes by loading their development builds on real hardware. The test department could tell at a glance that a system was running a development version of software, and bring issues to the attention of the developer who made it instead of entering it in the issue tracker.

Whenever the lead developer tagged a release candidate or released version, he/she would do so by modifying the version number string, committing that file, tagging the software at that state, and then restoring and committing the "-dev" suffix.

It's this last part of the process that I think is a little clumsy and I'm wondering how to improve it. For a personal project, I can tell that (for example) the binary in my project directory reports "v2.4.10" but it's actually "v2.4.10 plus changes that I'm still working on".

It isn't nearly as important to have the "-dev" suffix for development builds of a personal project, but I got used to that process and I quite like it.

How would you handle this? I'm using Git, and I considered always having the version number as "-dev" in the master branch, then tagging a release by making a branchless commit that changes the version number.

For example:
code:
* updated version number for v2.4.11 development (branch: master)
| * v2.4.10 (tag: v2.4.10)
|/
* version number was 2.4.10-dev in this commit
The Linux kernel, on the other hand, seems to have "-rc3" in all commits between rc3 and rc4 of a certain release.

Should I care about this at all? It's really only useful to get information about a binary that I didn't produce and am not familiar with. I don't keep old binaries around (that's what version control is for) and I'm the only one working on this project, so this is probably a moot point.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

BizarroAzrael posted:

If there a good way to find conflicting files in a working copy without attempting an update on it? We have guys that often get conflicts and it would be nice if I could scripts something that finds the problems so they can be fixed by hands, rather than have them kill the overnight update and the subsequent build process.
svn status -u will show remote changes from the server. I'm not aware of any tool that does what you want; conflict resolution isn't as simple as "did this file change locally and remotely"?

You could maybe do a 'svn diff BASE:HEAD file-in-working-copy' for each remotely updated file, but you'd basically be reimplementing (or wrapping) patch to determine whether it can cleanly apply the diff.


I have a more general question for you, though: do I understand correctly that this nightly update/build happens on each developer's machine? Why? Is it so hard to do a manual svn update whenever there are changes that you think you should have?

Does the build of your project take several hours or something? I'm just curious.

EDIT: Free Bees is right; I meant svn status instead of svn update.

Lysidas fucked around with this message at 06:58 on Sep 19, 2009

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

supster posted:

I'm trying to get some sort of version control working with my remote web server. I set up an SVN repository (on a hosted service) and figured that if I map my remote web server as a drive in Windows (via FTP) then I would be able to use the TortoiseSVN context menus normally in the mapped folder. However they don't appear at all - what are my other options?

I'm basically trying to commit remote files that I have access to via FTP.
Is FTP your only method of access to these files? Do you have shell access to the web server? What OS is it running?

Committing files with TortoiseSVN over a drive-letter-mapped FTP server is a bad idea. It isn't the worst idea, and you can probably get it to work, but there are much better ways. TortoiseSVN is probably configured to not display its context menus on network drives, and this is a good thing.

You might transfer everything in bulk to a directory on your machine, and commit from there.

You might consider a distributed version control system like Git or Mercurial -- you can just run git init or hg init on the live web server code, commit it, and clone the repository onto your machine.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

supster posted:

Unfortunately FTP is pretty much the only way I can access the files.
Do you pay for this web hosting?

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

supster posted:

Can you explain in some more detail how a distributed system will help me where SVN can't? Maybe you can expand on "synchronize it afterwards".

Maybe I should make clear that I'm not doing anything locally, files live remotely and work is done remotely. So "whatever the gently caress you want locally" doesn't help much because ideally* I don't want to do anything locally.

*using the term "ideally" pretty loosely here
What you're doing is all kinds of backwards (or it sounds like it).

How exactly are you editing these files remotely if you don't have the capability to do anything remotely? Are you using a text editor built into an FTP client or something (this is a horrible idea)? When you say that everything is done remotely, are you editing files on the live site (this is an even worse idea)?

You are wrong about not wanting to do anything locally, by the way. Normal development practice is to work in a local copy of the files (a Subversion working copy or a Git working tree or whatever) and commit to the repository as you make your changes. When a feature is complete or stable enough to be pushed to production, you can use the same version control system to update the files on the server (either svn up or git pull).

Whose arm do you have to twist to have your client let you use non-braindead development practices?

I repeat: What OS is the web server running?

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

LightI3ulb posted:

I have an SVN that stores reports that can be of quite excessive size through use of a perl module. I've been tasked with trying to find a way to have the module be able to add a file to the svn if the file does not already exist.

The easy part is figuring out whether or not the file exists, I just do a checkout on the file and parse the results. The hard part is trying to add the file to the svn when it does not exist. I need to find a way to be able to retrieve the .svn/entries file for the directory without checking out the entire directory.

Is there any way to get the .svn/entries file on its own, or is there a way to add a file to the svn without the .svn/entries file?
You might consider brushing up on some terminology and fundamental concepts to make communication about this stuff easier. Subversion is a software project. You do not have a Subversion and you do not commit to the Subversion. You have a repository.

Your question about the .svn/entries file is quite strange and I think you're making this a lot harder than it is. That, or I'm totally misunderstanding your question.

To list what's in the repository, use svn ls (this is much better than running 'svn checkout' and parsing that output). To add a file, svn add.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

nelson posted:

So if your source files are ASCII text files and you or the people you work with are like me :ohdear: you may want to go with CVS.

nelson posted:

I've managed to screw something up every VCS I've come in contact with :doh:.
What the hell is wrong with you? How did you manage to break a Subversion repository unless you were trying to do it on purpose? Did you try to directly edit the repository files, or something?

Try Git and let us know how badly you break it.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

nelson posted:

CVS is generally better than RCS for group work
As far as I know, RCS has no group/multi-user capabilities at all. Using RCS for group work seems difficult. Isn't that why CVS exists?

nelson posted:

I've managed to screw something up every VCS I've come in contact with :doh:.
Note to version control newbies who are reading this thread: this quote means that you should not follow nelson's advice. You will learn how to break things just as badly.

Never use CVS for a new project, and never use it at all if you can avoid it.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Lamont Cranston posted:

This is probably really stupid, but I want to know if it's possible. I have a project that I'd been working on and storing in a git repository. About a month ago I decided to scrap everything and start over, and stored that project in a separate repository. Now, there's obviously no reason to keep both of them around, but I'd like to have the old project's history. Is there a way that I can sort of stitch them together, so that after the last commit on the original project, the new project begins? (And it would appear that all of the old files were deleted because the first commit of the new project was empty)

This is certainly possible, and not stupid. It's called a "graft", in Git terminology.

See http://git.wiki.kernel.org/index.php/GraftPoint

This is a temporary mechanism that adds a fake parent to whatever commits you want. You can make it permanent by running git filter-branch after setting up a graft point. I'm not quite sure what the filter-branch arguments should be for this, but I'm sure it's somewhere on http://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html

EDIT: Be warned that git filter-branch rewrites history in bulk, changing the SHA-1 values of all commits downstream from where you grafted onto the old history. People won't like this if you've shared your history and they've based their work on yours.

EDIT 2: Actually it's quite easy:
code:
echo "$commit-id $graft-id" >> .git/info/grafts
git filter-branch $graft-id..HEAD
The repository where you're setting up the graft and running git filter-branch will have to have all of the objects for the old commits -- it'll suffice to copy the contents of old-project/.git/objects into new-project/.git/objects.

Lysidas fucked around with this message at 05:26 on Jan 22, 2010

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Would you ever turn down a job because of the version control system they use? I'd like to imagine that this has happened at least once, somewhere:

quote:

(during interview/tour/whatever)
:v: So what do you use for version control?
:reject: Visual SourceSafe, dictated by management.
:v: ...
:v: No, I won't use that.
:reject: All of our developers are required to.
:v: Well, this isn't going to work out. Thanks for your time.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

beuges posted:

My current idea is to create a repository for each client, and give my dev partner access to the ones he is involved with, rather than having to deal with permissions on a single repository, and likely exposing all my clients even if the actual contents of their projects is restricted.

My tree looks like so:
code:
  root
    |- personal 
    |- client1
    |  |-project1
    |  |-project2
    |-client2
    |  |-project1
  .....
You could also run git svn clone --no-metadata svn://your-host/client1/project1 to clone all of that project's history (and only that project's history) into Git.

You can import that back into a different Subversion repository, but that's a bit more complicated (not to mention pointless).

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

beuges posted:

the impression I've gotten from this thread is that the git clients for windows pretty much suck.
This isn't true anymore. msysgit is very stable and I enjoy using it on Windows. I was a diehard TortoiseSVN/SmartSVN user and never touched the SVN command line, but there are very few things I use a Git GUI for. Git's command-line interface is just leagues better than SVN's.

I also recommend looking into SmartGit.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Dromio posted:

code:
git remote add origin ssh://myhomemachine/myapp.git
Try this instead:
code:
git remote add origin myhomemachine:myapp.git
Git's SSH URLs (like NFS paths) use : to delimit hostnames and paths. You can omit the ssh:// also.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
He doesn't need --shared:
code:
--shared[={false|true|umask|group|all|world|everybody|0xxx}]
    Specify that the git repository is to be shared amongst
    several users. This allows users belonging to the same
    group to push into that repository. When specified, the
    config variable "core.sharedRepository" is set so that
    files and directories under $GIT_DIR are created with the
    requested permissions. When not specified, git will use
    permissions reported by umask(2).

If he's pushing to his home machine, he's probably the only user who will do so. If multiple people will use this repository, Gitosis is a much better idea anyway.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Zhentar posted:

Not only is the msysgit GUI eye-rape, but when I was trying it out last week trying to checkout a branch would crash it. TortoiseGit is at least usable, although it's still pretty easy to mess up.
I can't defend the GUI; I only use gitk. I've never experienced any instability or problems on Windows, especially not a crash (!) when trying to switch branches. git --version tells me "git version 1.6.5.1.1367.gcd48" and I've been using this on several machines with a few different versions of Windows (mostly XP Pro x64 and Server 2003 x86, but also XP Pro x86, Windows 7 x86 and Windows 7 x64). I do some decently complicated branching and merging, too. Have you filed a bug report or Googled around for anyone else who's experienced your problem?

As far as I know, TortoiseGit depends on an external Git executable (e.g. msysgit). SmartGit definitely does. If you had serious problems with msysgit, I'm not sure how TortoiseGit could be more stable.

(I feel like repeating myself for some reason: I couldn't fathom using Subversion without a good GUI (I really enjoyed SmartSVN), but I've found a GUI to be bothersome and useless for Git. Its command line interface is so clean and easy, partially because of the index. I don't have to specify the paths/files as part of the commit command, unlike SVN. Man up and use the CLI :clint: )

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Git or Mercurial, without a doubt. If you're starting from scratch, you have no excuse to use Subversion (centralized version control is obsolete). Distributed version control is never overkill in any situation; actually it's much quicker and easier to get a repository running. Because of this, I use Git to version control things that I never would have thought of before.

I heartily recommend Git, but Mercurial's better Windows support might be better for you. As mentioned earlier in this thread, TortoiseHg is great and just hit 1.0.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Sizzlechest posted:

He's looking to set up a repository at work. He didn't explicitly say it, but I'm going to go out on a limb and guess the following are true:

1. There's a limited and well defined group of people who need access to the system.
2. He's not opening up the source code to the world.
3. His company owns all aspects of the code.
4. It's a networked environment.

There's no real reason to implement a distributed system. Nobody is going to branch the codebase and develop their own flavor for themselves. Nobody has the right to say, "I want to work in private," since that person's work belongs to the company. A distributed setup increases the odds of larger merge conflicts. If you're working on the Linux kernel and don't have an issue with deadlines, then great. In the real world, not so much.

Creating a SVN repository is a single command if you script it, and any SVN admin worth his salt will do so.

You could argue git is easier/better to use, but considering it's a Windows environment, the choice of Subversion is easy.
No, given that it's a Windows environment, the choice of Mercurial is easy. I'd argue that Git is superior in every way (and easier to use), but I'll admit that it isn't yet suitable for all Windows developers.

A distributed setup does not, in itself, increase the odds of larger merge conflicts. Merging as late as possible increases these odds. What kind of VCS do you think encourages people to delay merging as long as they can? One where repeated merging is painful (and destroys history), or one in which merging is clean, easy and fast? When I have a long-running topic branch, I regularly merge the master branch into it and fix any merge conflicts as they arise. Then, when I merge in the other direction, it's trivial. (Note that this is equivalent to keeping unstable changes in your SVN working copy and repeatedly 'svn up'ing whenever anyone else commits.)

It's absurd to suggest that a DVCS would inspire employees to fork the codebase and never contribute their changes back to the mainline. I do, however, have the right to say "I want to work in private" -- I get to incrementally commit and refine my changes until they're ready to share with others. My experimental branches don't clutter up everyone else's history unless I decide to push them to the central repository, but I can share them if I want to.

I'll go so far as to say that starting from scratch with Subversion is stupid. Even for two people, a distributed system (and the branching capabilities that it comes with) is superior in every way.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Milde posted:

Just out of curiosity, what makes Git easier to use than Mercurial for you? I use both, but I find Mercurial a lot simpler UI-wise.
I'm having a harder time elaborating on this than I expected, which means that Mercurial has improved quite a bit since I last used it. Note that I said "easier", not "simpler", though :)

I primarily use command-line tools, and I've completely fallen in love with the index. I'm a big fan of staging only parts of a file; it's a neat feature. I also really like the ease with which Git lets you rewrite history -- as far as I know, Mercurial doesn't ship with features like rebasing, commit amending, etc. (not to mention git filter-branch).

Essentially, I understand Git a lot better than Mercurial, so I see it as easier to use. ("what? you mean hg pull doesn't merge? that's stupid") I should probably stop stating this as objective truth :downs:

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Sizzlechest posted:

No, I said you're cockamamie hybrid setup is.
I believe that was a Venn diagram that illustrated the capabilities of different VCS types, and not a suggestion to use git-svn or something equivalent.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Sizzlechest posted:

So...you're implementing a centralized system?

You do if you have to look in multiple places for changes committed locally. That's especially fun when someone's out or on travel. With a centralized system, there's ONE place to look for all work in progress.
You don't seem to get decentralized version control. In almost all cases, there is one central place where the code lives, but that should be a social/organizational distinction and not a technical one. Linus' kernel tree is a great example. That's the single canonical place for the kernel source, but that doesn't mean that Linux uses a centralized development model :confused:

Linus said it much better than I will: http://lwn.net/Articles/246381/

In a development organization, changes should eventually make their way into a central repository. A DVCS gives you a lot of freedom in how this happens (like through a single person who collects changes, for example).

Sizzlechest posted:

Working copy changes in subversion also run instantly. Commits to a centralized server whether in svn or git will take longer, obviously.
What are you trying to say here? The point is that there's a lot more you can do locally with a DVCS.

Sizzlechest posted:

And you don't need a decentralized VCS to accomplish this. The type of branching you're talking about is fast and easy in SVN, too. That's not the kind of branching and merging Linus was talking about when he advocates a decentralized system for Linux. You've got thousands of developers working independently, working on things that may never get into an actual release. They need a way to work on their own and merge later. Two developers working in the same shop don't need to work this way, nor is it advantageous for them to do so.

When git first came out, SVN was at 1.4 and it's merging was complete poo poo. In the latest version (1.6), it keeps track of branches and merges just fine. What's more annoying? Resolving a little merge conflict now or a fuckton later?
I've already addressed your merge conflict strawman, but you either didn't notice it or chose to ignore it.

Subversion absolutely does not keep track of branching and merging "just fine".
  • When merging, the entire branch is squashed into a single commit that appears to have been written by the merge committer.
  • SVN's default log operation doesn't show you the branch's commits; you have to view the entire repository at some previous revision that isn't immediately obvious.
  • --reintegrate is just silly :mmmhmm:

As the Subversion book says, "The bottom line is that Subversion's merge-tracking feature has an extremely complex internal implementation, and the svn:mergeinfo property is the only window the user has into the machinery." This just screams to me that the Subversion devs painted themselves into a corner with merging, and the best thing to do is scrap the system and redesign it from scratch. Incidentally, this is exactly what happened with Git, Mercurial, and others!

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
I'd heard that Mercurial didn't have lightweight local branches like Git, then heard that it did, but I didn't realize that it was through an extension and that these bookmarks can't be easily pushed or pulled. Git's local branches seem much easier to me. I just remembered that I strongly dislike using .hgtags -- I think it's bizarre that you can check out a tag, but immediately after doing that, the tag kind-of no longer exists.

Git got it right; branches and tags are just pointers to commits. Tags don't move, but branches do.

Mercurial's command set seems simpler, but Git's history model makes much more sense to me. I believe that this is the difference between 'simple' and 'easy': Mercurial is easier to start using, but Git's design makes a lot more sense.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Sizzlechest posted:

It's a specious argument since a centralized server doesn't require the same kind of merge tracking as a distributed one. There's a single repository everyone is working from. People aren't creating personal branches to work in and then merging them with public ones. They're working from a shared branch or trunk. Merge conflicts get resolved on incremental commits. Merging between branches and the trunk is tracked sufficiently. I suppose you could do private branching in Subversion, but there's no logical reason you'd want to, nor was it designed with that in mind.
Your argument appears to have changed from "you can branch and merge with Subversion just fine" to "well, you don't really need to branch anyway". Classic SVN brainwashing. I'm a single developer working on my company's website, and the Git history isn't anywhere near linear. I make topic branches very often (for larger changes) and merging is completely painless.

If you're not making branches, then what do you do with experimental changes that aren't ready to go live yet? Do they sit in your working copy until they're ready to commit? (That's a horrible idea.) Do you commit them to the trunk? (That's even worse; what happens if you need to quickly fix a bug, but your experimental changes are mixed in with other important bug fixes that you can't easily cherry-pick?)

Sizzlechest posted:

There's no reason why a private company like the one mentioned needs to implement a distributed system. They don't need have one of them play "merge manager" and reject on a problem like Linus does. They can handle conflicts as they happen, which improves communication.
Like I said, you don't appear to get distributed version control. The tool doesn't force you to use an integration manager or dictator/lieutenant workflow like the Linux kernel. The tool doesn't force any kind of workflow at all! (Again, you're showing symptoms of Subversion brainwashing; a centralized version control systems does force a certain workflow.)

I absolutely agree that two people should use a centralized workflow -- both of them have individual repositories and have push access to the central repository. DVCS tools are still have vastly superior features.

Thermopyle posted:

I'm fairly noobish when it comes to this stuff...but I think the argument you need to make is why shouldn't they use a DVCS.
This is absolutely correct. Sizzlechest's argument is "it's too hard", which was refuted some time ago. DVCSes are easier to set up, easier to collaborate with, easier to branch and merge with, faster to work with, allow disconnected operation and are generally superior in every way.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Bonus posted:

This is a constant back and forth discussion here on SA. People will claim how you should use SVN because it's "good enough" and "you don't need more". Even after being faced with arguments that distributed version control systems can do pretty much everything that centralized ones can do and that they can do it better.

Hell, this happened a few pages ago in this thread. At the time, I wasn't as experienced with Git and I hadn't yet Seen The Light. Now that I have, I'm an enormous jackass to anyone who suggests starting from scratch with Subversion.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
In case you didn't know, the msysgit version of Git 1.7.0.2 was released a few days ago.

If you're using 1.6.5.1, I strongly recommend updating. Apparently there has been a lot of work in the Git mainline to make it perform better on Windows, and it definitely shows in this release. It feels much snappier to me.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Knackered posted:

:words:
Great to hear, though the debate was mostly Sizzlechest digging in his heels and defending an inferior system that really should be put out of its misery. After using Git for so long, I'm not exaggerating my opinion in the slightest.

Long ago, I was going to say something about your original post:

Knackered posted:

I was thinking of using a simple SVN over GIT/Mercurial.
...
Of course the other guy if all for using GIT/Mercurial, which I think is over kill.
I meant to respond to this in particular; you had this backwards regarding which was simple and which was overkill :) . There's a bit of a learning curve with the core concepts of a DVCS, but once you get past that, everything makes more sense and is easier to work with.



Since I'm in this thread, I may as well share some useful information too:

Zhentar posted:

AutoCrLf handling is, at best, poor. It will mark files as modified immediately after checking them out, which will interfere with a lot of operations (no switching for you).

I've seen this happen and I believe I have an explanation for it. I would guess that your repository contains files with CR+LF line endings (i.e. the actual content of the blob objects).

If core.autocrlf = true, Git will translate everything to a CR+LF line ending on checkout. However, since it would be committed with LF line endings instead of the CR+LF in the current commit, it's marked as modified (even after a git reset --hard or git stash). I believe that the best way to fix this is to commit the changes, thereby fixing the line endings in the actual repository. This will have detrimental effects on git blame, though. I'm sure you could fix the line endings in all previous commits with git filter-branch, but that can be quite disruptive (see the documentation on recovering from an upstream rebase)

Off the top of my head (i.e. I haven't had to do this in a while and I'm on a Linux machine now), I've found this sequence of operations to fix most CR/LF problems except for the one that I described above:
code:
git config core.autocrlf false
rm .git/index
git clean -dfx
git config core.autocrlf true
git reset --hard
This will rebuild the index and do a clean checkout of the entire working tree. Some or most of those commands may not be necessary and your mileage may vary depending on the root cause of your specific situation, but I've found this to work very well in the rare cases when I've had to resort to something like this.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

HFX posted:

I've been using git with an svn connector. I had been doing all rebase and commits from the master after merging local branches. However, the rebase operation has an unfortunate side effect of removing the local git history for the branch being merged back to trunk. Can someone recommend me a way to keep the history and still be able to do updates from SVN?

The short answer: create a new branch (like git branch old) before running git svn rebase.

I'm not sure if you should make new commits on the old branch, though. Repeated rebases of the same commits might not be handled correctly (though they seemed to be in my quick test).

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Lexical Unit posted:

I'm running git from Mac OS X and developing on a Windows VM.

This seems like a very bad idea, and I'm not surprised in the slightest that you're having problems. Are you using Git over a network mount, or something like that?

I recommend installing msysgit in the Windows VM and using Git from there. If you're using it on OS X, you're probably well-versed in the command line and won't mind a sub-par GUI (though I really like SmartGit, and it just hit version 1.5).

You should probably make sure that the repository's core.autocrlf value is set to false. msysgit sets that to true by default for new or cloned repositories, but Git on OS X won't. Your Git repository probably contains CR+LF line endings, and that combination can cause problems (as I mentioned a few posts ago).

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Thermopyle posted:

I've got a project hosted on github, that I'm totally rewriting. Starting from scratch.

What's the recommended course of action? I'd like to keep the currently functioning version as the latest version available on the project page for now and then when I've got the rewrite functioning make it the latest available version.

This is probably a common occurrence, but I'm new to version control and git.

Rewrite it from scratch, committing locally to do so. When you're ready, push your changes to GitHub.

If you aren't comfortable having your work in only one place (I'm not), make a bare clone of your repository, preferably copy it to a different machine that you have access to, and push to that repository quite often.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Spengler posted:

It may be as much a philosophical question as a practical one, but pushing to an extra repo to avoid branching in a situation where it seems warranted seems more like it's extra work than a shortcut.

It absolutely is appropriate to make a new branch, and I guess I considered it basic enough that I didn't mention it in my post (oops). I didn't think Thermopyle wanted to push that new branch to GitHub yet; he did say that he didn't want his rewrite available on the project page and I interpreted that as "anywhere on the project page". Now that I think about this more, pushing the new branch to GitHub is probably what he wanted (or close enough).

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Detailed instructions here (this describes a superset of what you want to do): http://progit.org/2010/03/17/replace.html

Scott Chacon posted:

For example, say you want to split your history into one short history for new developers and one much longer and larger history for people interested in data mining. You can graft one history onto the other by replaceing the earliest commit in the new line with the latest commit on the older one. This is nice because it means that you don’t actually have to rewrite every commit in the new history, as you would normally have to do to join them together (because the parentage effects the SHAs).

Let’s try this out. Let’s take an existing repository, split it into two repositories, one recent and one historical, and then we’ll see how we can recombine them without modifying the recent repositories SHA values via replace.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Zhentar posted:

AutoCrLf handling is, at best, poor. It will mark files as modified immediately after checking them out, which will interfere with a lot of operations (no switching for you).

ToxicFrog posted:

The problem he refers to is not with the editor, but with git itself. It's possible to get into a situation where the following happens:

- you check out a commit
- git fucks up with the CRLF conversion somewhere
- now git thinks all your files are modified because the line endings differ
- you can't switch branches or anything because git thinks everything is modified even though it isn't

Personally, I haven't observed this behaviour recently, but then, I haven't used git on windows recently either.

Lysidas posted:

I've seen this happen and I believe I have an explanation for it. I would guess that your repository contains files with CR+LF line endings (i.e. the actual content of the blob objects).

If core.autocrlf = true, Git will translate everything to a CR+LF line ending on checkout. However, since it would be committed with LF line endings instead of the CR+LF in the current commit, it's marked as modified (even after a git reset --hard or git stash).

I was very interested to see this commit when git pulling my clone of Git itself.

Finn Arne Gangstad <finnag@pvv.org> posted:

autocrlf: Make it work also for un-normalized repositories

Previously, autocrlf would only work well for normalized
repositories. Any text files that contained CRLF in the repository
would cause problems, and would be modified when handled with
core.autocrlf set.

Change autocrlf to not do any conversions to files that in the
repository already contain a CR. git with autocrlf set will never
create such a file, or change a LF only file to contain CRs, so the
(new) assumption is that if a file contains a CR, it is intentional,
and autocrlf should not change that.


The following sequence should now always be a NOP even with autocrlf
set (assuming a clean working directory):

git checkout <something>
touch *
git add -A . (will add nothing)
git commit (nothing to commit)

Previously this would break for any text file containing a CR.

(commit message continues, but the rest isn't really relevant here)

:woop:

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

epswing posted:

I should have clarified that I'd have a clone specifically for accepting changes. In fact I could have as many clones as I have pushing developers, each hg serveing on a different port.

So you'd be creating a "public" repository for each of them to push to? You've independently created the "integration manager" workflow described at http://whygitisbetterthanx.com/#any-workflow (ignore for the moment that this page is Git evangelism; the DVCS workflows described are mostly tool-agnostic).

Having a clone for each developer to push to (that you create and manage) is a strange idea; it makes more sense for each developer to manage that clone themselves. Each of them can publish their code into their public repository, and you pull from those at your leisure. If you like what you see, push it to the central repository (which the developers should regularly pull from).

It's a good idea for developers to have separate public/private repositories: one that is used for actual work and one that's used to publish changes to others when a feature/branch/etc. is stable enough to integrate. If you're pulling directly from their workspace without warning, you're likely to obtain half-done features/changes/etc.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Your post didn't explicitly say this, and I want to rule it out before any more investigation: did you commit the change(s) before switching back to master? Checking out a new branch should preserve local un-committed modifications (and untracked files) that don't conflict with the branch you're switching to.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Argue posted:

What's the best way of working with a project with a number of local-only configuration changes in git? Right now I have a branch that i continually rebase and never commit, but that's kind of a pain. I can't .gitignore them because some of the files have already been versioned. I can git update-index --assume-unchanged them, but git stash fucks things up when I do. Anyone have any other hints?

Some questions:
  1. Can these configuration changes be entirely contained a config file that describes how the software should operate?
  2. Does the software have a mechanism to read a configuration file to determine its behavior?
  3. If there's no configuration file mechanism, can you implement one?

If you answer 'no' to 1 or 3 for technical or political reasons, then I don't really have any useful advice.

Otherwise, I would use a default configuration file (probably named 'default.conf') that is version controlled, and an override file that is .gitignored (maybe named 'local.conf' or 'override.conf' or something). I've used this style with a lot of success in the past.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

CHRISTS FOR SALE posted:

Hey git experts, I installed git on my jailbroken iPhone, and I'd like to know why I can't clone repos. Here's what happens when I try to: http://gist.github.com/608718

  1. What version of Git?
  2. What command did you run, exactly? Was it
    code:
    git clone "http://github.com/dcinzona/LockInfo-Status-Bar-Icons---Winterboard-Theme.git/GMT Statusbar
    Icons.theme"Initialize GMT Statusbar Icons.theme/.git
    This is definitely not a Git repository URL.
  3. Is this the only repository that you can't clone?
  4. Did you try the git:// URL?
  5. You do know that you can't clone a subdirectory of a repository, correct? Is that what you tried to do?

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Yakattak posted:

For some god drat reason, git isn't making commits when I merge :saddowns:. For instance, I'm on master and I want to merge in issue3.

git merge issue3

That by default is supposed to make a commit that's like "Merge branch issue3" or something along those lines. However, such a commit never appears in my log, and it really isn't committing the merge. I've tried doing git merge --commit issue3 but still no commit. I'm on Mac OS X and git version 1.7.2.3.

Does the merge output contain "Fast-forward" or "Merge made by recursive."?

If this is the situation:
code:
o---o---o---o---o---o---o
    ^                   ^
  master              issue3
then running git merge issue3 on the master branch will just move the master branch (think of it as a pointer to a commit) forward without losing any history. Merge means "make this branch contain all of the commits in that other branch", and making a new commit isn't necessary if e.g. issue3 is a superset of master.

If you really want a new commit after the merge (i.e. you want the history to look like this afterward):
code:
                      master
                        v
o---o-------------------o
     \                 /
      o---o---o---o---o
                      ^
                    issue3
then you should run git merge --no-ff issue3 ("no fast-forwards").

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Yakattak posted:

Yeah it does fast forward. What are the drawbacks to not fast forwarding?

The only drawback is that it makes the history less linear and slightly harder to follow if you're looking at it later (EDIT: and there a lot of other crazy complicated merges in this vicinity).

On the other hand, if you don't fast-forward, the structure of the graph can easily tell you which commits were related to issue3. You lose this information if you do a fast-forward, but this isn't a consideration if you prefix your commit messages with "issue3" or "i3" or something like that.

Lysidas fucked around with this message at 23:33 on Nov 11, 2010

Adbot
ADBOT LOVES YOU

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
God drat git diff --stat @{yesterday}.. is awesome. Makes me feel like I've accomplished something after some major refactoring. Just thought I'd chime in with that.

Lysidas fucked around with this message at 21:01 on May 27, 2011

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply