error syncing with cyanogenmod repo - android

I have followed the instructions here to get the cynogenmod source on my system.
i was able to do the build successfully. I didn't do any local source changes. Now when i try to get the latest source using repo sync command, I am getting the following errors
error: Your local changes to the following files would be overwritten by checkout:
Android.mk
extendedcommands.c
flashutils/Android.mk
flashutils/flashutils.c
flashutils/flashutils.h
mounts.c
mounts.h
nandroid.c
roots.c
Please, commit your changes or stash them before you can switch branches.
Aborting
error: Your local changes to the following files would be overwritten by checkout:
encore.mk
init.encore.rc
Please, commit your changes or stash them before you can switch branches.
Aborting
<few more errors like this.........>
error: bootable/recovery/: CyanogenMod/android_bootable_recovery checkout 50822991460cbee65757e9de12b29e39238d6386
error: device/bn/encore/: CyanogenMod/android_device_bn_encore checkout f6586ab41f0e3f5acfa16b43f9b17008e9bb0524
I have tried repo forall -c git reset --hard HEAD without success.
Any suggestions on how i can resolve these errors?

Apparently I was facing this issue because I had the repository on an NTFS partition. NTFS was not storing the permissions on the file properly and Git was seeing that as a change.
You can force Git to ignore the permissions on the file while looking for changes by using the following command:
repo forall -c git config core.filemode false
(Not sure if this has any side effect. If there is, please let me know!)

Related

Cannot build chromium android

I'm trying to build android apk with instruction`.
I'm trying to run gclient runhooks this command.
but I get this error
D:\Android\chromium\src>gclient runhooks
error: Your local changes to the following files would be overwritten by checkout:
git_cl.py
tests/git_cl_test.py
Please commit your changes or stash them before you switch branches.
Aborting
Failed to update depot_tools.
I'm trying to commit, I got this
D:\Android\chromium\src>git commit
HEAD detached at origin/master
nothing to commit, working tree clean
D:\Android\chromium\src>git stash
No local changes to save
D:\Android\chromium\src>git stash pop
No stash entries found.
Please help me to build chromium apk and how to import into android-studio and run.
Thanks in advance.
The error message has an important clue:
Failed to update depot_tools.
The issue is in the depot_tools repository, not the Chromium repository itself.
In the directory where you checked out depot_tools, run git stash (non-destructive) or git reset --hard (destructive). You shouldn't need to do anything in the chromium/src directory for this particular error.

Android Studio git: failed to traverse parents error

I've been running Android Studio on Windows, with git doing the versioning, and git pushing using git bash for Windows. I've been doing the same thing for all that time, without issue.
Then today, in the event log in Android Studio after opening I see:
17:29 VcsException
error: Could not read 5188c7b8677be145b04f079e6f9cab08e5c19240
fatal: Failed to traverse parents of commit 50da9e67a67598125b860984db9e493bd5d1f2ee
during executing git -c core.quotepath=false log HEAD --branches --remotes --max-count=2000 --pretty=format:%x01%H%x02%ct%x02%an%x02%at%x02%ae%x02%cn%x02%ce%x02%P%x02%s%x02%b%x02%B%x02%d%x03 --encoding=UTF-8 --decorate=full --
And when I try a git operation in the git bash console (Windows) I get:
$ git commit -m 'new stuff'
fatal: unable to read tree 4dfc5598677be145b04f079e6f9cab0833555566
The following is an extract from running git fsck... there is a long list which annoyingly in git bash is not scrollable or selectable:
$ git fsck
dangling blob 7be145b04f079e6f9cab0835664dfc5598673555
missing blob e6f9cab0835664dfc559e145b04f07986735557b
missing tree b04f07986735557be6f9cab0835664dfc559e145
... (lots of dangling blob, a few missing blob, one missing tree) ...
What can I do to fix this?
So, since I've been pushing regularly to the remote repo so I know that is pretty up to date, I followed the low-tech suggestion set out here, combined with the first comment to that suggestion.
So:
create a temporary folder in whatever location you want
clone the repo into that folder with git clone
git#bitbucket.org:myaccount/myproject.git
move the .git folder in the existing project folder out into another temporary folder somewhere
move the .git folder from the repo cloned in step 2 into the project folder, to replace the old one moved out in step 3
and that was it... a git add / commit / push we seem to be
back on track

Removing build folder from git

I have pushed a build folder to my remote repo; but the .gitignore file clearly has this line (/payu_ui/build); But i found out since the build files were already tracked once and now that i wrote a line in .gitignore will not really ignore the build folder. So i want to remove it from git from being tracked (the complete build folder) so i used this command
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch payu_ui/build/' --prune-empty --tag-name-filter cat -- --all
But every time i run this command it gives an err saying
fatal: bad revision 'rm'
So what is going wrong; every time i click the commit option from IDE it shows that 1300 files needs to be committed (its annoying me)
Any help will be appreciated;
1. I dont want to track these build files(from payu_ui lib)
2. I dont want to push them to remote repo (but its already thr and beleive once i track from local and push them it gets deleted in remote repo; if it doesn't i'll manually delete in remote repo)
Well you may just do the following,
Remove the line from gitignore for now.
Locally delete the folder.
Push out the change so the folder gets deleted from remote as well.
Now add the line to gitignore.
I recently faced the problem and that is what i did.
remove those build files (or whole folder) from your computer
rm -r [direction to files]
then add, commit and push all your changes (actually the change will be removing those files from repository), if you have set .gitignore
file properly, git will stop tracking those files

Android Studio .iml git issue

When I try to make a "git pull" I get the following message :
error: The following untracked working tree files would be overwritten by merge:
blablabla.iml
Please move or remove them before you can merge.
Aborting
I try to checkout the .iml and add it to my gitignore but I keep receiving this message. Does someone know how to fix it?
Regards
Jose
Git will not allow you to execute a pull that would cause you to lose changes in your working directory (this is good for obvious reasons).
Adding the file to your .gitignore will tell git not to push your changes to that file to other repositories, but it does not prevent you from pulling other repositories changes of those files. So this actually has no effect on the operation you are trying to do. As a side note, it is not recommended to put iml files in a .gitignore: What should be in my .gitignore for an Android Studio project?.
Here's what I would do:
Stash your local changes: git stash save "My iml changes"
Then checkout the code: git pull
Optionally, get your local changes out of the stash: git stash pop. Or, if you prefer, git stash drop stash#{0} (As pointed out by #LoyalRayne, you might not need these changes). See the differences with git stash show stash#{0}.
If you want the contents that are currently in the repo, you can revert your local changes first with git checkout blablabla.iml, then pull. Or, if you want to keep your local changes, do git stash, then git pull, then git apply.
After doing the above steps, you may add the file to .gitignore. Make sure to remove it from source control as well with git rm --cached blablabla.iml. Note that when it is remove from source control, it will get deleted on other people's machines when they do their next git pull, so they will want to create a backup.

What does repo init and repo sync actually do?

I posted this question at Android Enthusiasts but figured it was the wrong place to ask, so I deleted it from there and asking it "again" here.
This is such a noob question, and pardon me if it is, but I just want to understand the underlying concepts clearly. Reading repo help and Google's repo command reference page doesn't really enlighten much. I understood some bits from Google's reference page, but I still need some more clarifications.
Following the instructions on how to download android source, I executed these two commands on an Ubuntu shell: (I've taken cared of all the prerequisites for the environment.)
~/android4.2.2$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1.2
~/android4.2.2$ repo sync -j4
After waiting half a day for repo to finish downloading, I ended up with 19G of downloaded material in android4.2.2 directory. So what exactly just happened, and why did it reach 19G when Google said I should only be expecting around 8G of source files?
repo is a python wrapper script for git, its Google Source page defines it as
repo - The Multiple Git Repository Tool
repo init command initializes repo in the current directory. That's, it downloads the latest repo source and a manifest.xml file that describes the directory structure of the git repositories, and store all of these in .repo sub-directory in the current directory. In your case, you have used an optional -b argument which is used to select the branch to checkout. By default (i.e., when -b argument is not used), master branch is used.
repo sync updates working tree to the latest revision. That's, it synchronizes local project directories with the remote repositories specified in the manifest file. If a local
project does not yet exist, it will clone a new local directory from the remote repository and set up tracking branches as specified in the manifest. If the local project already exists, it will update the remote branches and rebase any new local changes on top of the new remote changes. -j argument is used to set number of parallel jobs to execute. The default value can be defined in the manifest, and also can be overridden in command line as in your case.
why did it reach 19G when Google said I should only be expecting around 8G of source files?
That should be because besides the source files, you will get all the history of Android since the beginning of the time :)
Hope this helps.

Categories

Resources