git cloning Goldfish object corrupt error - android

I was trying to clone Android Goldfish kernel source code by using the following command,
git clone https://android.googlesource.com/kernel/goldfish
but as it needed to download around 900MB of data I thought what the heck and went through with this one,
git clone https://android.googlesource.com/kernel/goldfish --branch android-goldfish-3.4 --depth 1
this reduced the download size to around 120MB and the downloading was done but with an error during unpacking objects.
Later when I used git status I saw a large number of files were deleted and they were shown as if they not even added and committed. I, foolishly, added them and committed them as new commit named 'local commit'.
git log --oneline
ca6ded2 Local Commit
2a51970 Merge branch 'android-3.4' into android-goldfish-3.4
c9cb2c8 UPSTREAM: netfilter: x_tables: fix unconditional helper
ac342b9 Merge branch 'android-3.4' into android-goldfish-3.4
Now after checking the files on remote, it became clear that the files which were shown deleted and which I committed are in the remote but not showing locally. So I tried to reset to previous commit. But these errors are shown:
git reset 2a51970
error: failed to read object b56d12bf5900c8f266132bc9b50dadfb092af10a at offset 26783674 from .git/objects/pack/pack-3ce58ac57f33a98f718e926caccca5ea5fa3a1fd.pack
fatal: packed object b56d12bf5900c8f266132bc9b50dadfb092af10a (stored in .git/objects/pack/pack-3ce58ac57f33a98f718e926caccca5ea5fa3a1fd.pack) is corrupt
fsck shows following:
git fsck
Checking object directories: 100% (256/256), done.
error: .git/objects/pack/pack-3ce58ac57f33a98f718e926caccca5ea5fa3a1fd.pack SHA1 checksum mismatch
error: index CRC mismatch for object b56d12bf5900c8f266132bc9b50dadfb092af10a from .git/objects/pack/pack-3ce58ac57f33a98f718e926caccca5ea5fa3a1fd.pack at offset 26783674
error: cannot unpack b56d12bf5900c8f266132bc9b50dadfb092af10a from .git/objects/pack/pack-3ce58ac57f33a98f718e926caccca5ea5fa3a1fd.pack at offset 26783674
error: index CRC mismatch for object 6149b476d9dffe06bcd1e3e3136bc335fd3dbf98 from .git/objects/pack/pack-3ce58ac57f33a98f718e926caccca5ea5fa3a1fd.pack at offset 27883077
error: inflate: data stream error (invalid distance too far back)
error: cannot unpack 6149b476d9dffe06bcd1e3e3136bc335fd3dbf98 from .git/objects/pack/pack-3ce58ac57f33a98f718e926caccca5ea5fa3a1fd.pack at offset 27883077
Checking objects: 100% (41134/41134), done.
My question:
Is there a way to fix this without initiating the cloning process again.
AND
Was the cloning done properly or I did something wrong there?
Thank you.

It seems I found a way to fix this!
For all object corruption error relating to git, I think the best, hassle free, thing to do will be to make use of git-repair.
My procedure to Fix this (Ubuntu 16.04):
Install git-repair
sudo apt install git-repair
Goto the local git repo directory
Run git-repair
git-repair
Thats it! All the corrupt objects were fixed(not going into technical details!) and the repo was in working condition.

Related

error: Unable to fully sync the tree while cloning AOSP

Downloading android-8.1.0_r20. After downloading 45gb this error occurs.
Error message in the terminal:
error: libcore/: platform/libcore checkout ed54621bf38a761388fe5ea56d71c64befaa9f40
error: Cannot checkout platform/libcore
Checking out: 100% (592/592), done in 15m55.329s
error: Unable to fully sync the tree.
error: Checking out local projects failed.
Failing repos:
external/libunwind
external/kmod
frameworks/compile/slang
external/autotest
libcore
Try re-running with "-j1 --fail-fast" to exit at the first error.
The source link of this git tag
https://android.googlesource.com/platform/libcore/+/refs/tags/android-8.1.0_r20
Can anyone please tell me how to resolve this?
This issue is probably due to the Partition type of your drive, where you are downloading the code.
Please make sure the drive Partition type is a Linux Filesystem (i.e. ext4).
It's strange but such issue happens when I try to sync AOSP on my Ubuntu PC to external usb-ssd drive but syncing to main drive to home directory works fine.
Moreover to reproduce such issue it is enough to clone one of the mentioned repos, e.g. libcore:
$ git clone https://android.googlesource.com/platform/libcore -b android-11.0.0_r45
and then check it with git status,
on main drive:
$ git status
Not currently on any branch.
nothing to commit, working tree clean
on external usb-ssd drive:
$ git status
Not currently on any branch.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
deleted: Android.bp
deleted: AndroidTest-core-tests.xml
deleted: CleanSpec.mk
deleted: JavaLibrary.bp
deleted: LICENSE
deleted: NOTICE
...
<6590 other deleted files>
...
Untracked files:
(use "git add <file>..." to include in what will be committed)
Android.bp
AndroidTest-core-tests.xml
CleanSpec.mk
JavaLibrary.bp
LICENSE
...
<total 34 untracked files>
...
xml/
Summary:
If you use external drive for cloning AOSP try to do it into main drive (home directory).

Android studio pushing commit failing

Earlier I was attempting to remove a commit from my commit history, and went through some stackoverflow threads doing stuff like rebasing etc.
Now here I am attempting to push a new commit, but I get this error which I feel is because of what I did earlier.
Error rebasing
fatal: update_ref failed for ref 'refs/heads/master': cannot lock ref 'refs/heads/master': ref refs/heads/master is at 9529c90e148e9b2620db0f366587312e75d507b6 but expected 808b9dfbc4141d16a29fadb4bd8171c6fe8f4914
Yes, you need to rebase first and then submit the checklist, currently the local and remote are at different level.
Just save your changed files, in some tmp directory, do the rebase(Menu->VCS->GIT->Rebase).
Once origin and remote are at same level, you may manually copy these files from temp, which will be shown in version control section of android studio. You can rightclick changelist and commit and push.
Regards
Ashish

12:44:45 PM Push failed: fatal: repository not found but it exists

I am using Github to sync my Android Studio Project.
I have been able to commit and push successfully for over a month.
After adding some files, I received this error.
12:44:45 PM Push failed: fatal: repository 'https://rrtigga#github.com/rrtigga.GetDisciplined1_0.git/' not found
However, the repo exists...
Here is a snippet from my terminal:
Rohits-MacBook-Air:GetDisciplined1_0 Spicycurryman$ git remote add origin rrtigga#github.com:rrtigga/GetDisciplined1_0.git
fatal: remote origin already exists.
Rohits-MacBook-Air:GetDisciplined1_0 Spicycurryman$
This is kind of an awkward error... I did some research and was unable to produce a solution.
GitHub: ERROR: Repository not found. fatal: The remote end hung up unexpectedly (different from similar posts apparently)
EDIT: It really exists:
https://github.com/rrtigga/GetDisciplined1_0
What is the problem here and how can I fix it?
You have a remote called origin which is configured to point to https://github.com/rrtigga.GetDisciplined1_0.git/, which is not the correct URL for your repository. You should be using either https://github.com/rrtigga/GetDisciplined1_0.git for access over HTTPS, or git#github.com:rrtigga/GetDisciplined1_0.git for SSH.
The error "remote origin already exists" means what it says: you're trying to add a remote with the same name as one that already exists. You need to either delete it first with git remote rm origin, or use git remote set-url to change the URL of the existing remote.

Failed to initialize Git team provider

whenever I add an Android project to a git repository using the eclipse plugin EGit I get this Error message
Failed to initialize Git team provider.
when visualising the error log I get this :
Failed to initialize Git team provider.
Problems encountered while moving resources.
Could not move '/SearchInContatsWithLoader'.
Could not move: D:\AndrComp\SearchInContatsWithLoader.
Problems encountered while deleting files.
Could not delete: D:\AndrComp\SearchInContatsWithLoader\libs\android-support-v4.jar.
Could not delete: D:\AndrComp\SearchInContatsWithLoader\libs.
Could not delete: D:\AndrComp\SearchInContatsWithLoader.
Check if you don't have a windows process blocking those file (keeping an handle on them), which would prevent another process (like EGit) to move them.
To solve the issue, try to close as many processes as you can (or, even better, reboot and launch just Eclipse), and try again your operation.

Android native code profiling

I am trying to profile native android code, but I am getting the
following error.I am running the code on a linux machine.
$tracedmdump profile post-processing
traces...
Static basic blocks: 64525, Dynamic
basic blocks: 87073132
Static instructions: 412004, Dynamic
instructions: 509641730
Elapsed seconds: 26.46, simulated
instructions/sec: 19.3M
generating dexlist output...
generating dmtrace data...
Error: stack overflow (500 frames)
If anyone knows how to debug this issue...please help
Thanks and Regards,
Bharat Pawar
From your post and the Android GIT commitdiff it looks like this line in the "tracedmdump" shell function went wrong:
q2dm -r $ANDROID_PRODUCT_OUT/symbols $TRACE $KERNEL $TRACE/dmtrace
The q2dm command is part of the qemu emulator tools for Android.
Looks like the problem has actually been fixed and changed source committed.
a. If you can, synchronize your local GIT repository with the Android GIT repository and build yourself a more current version of the q2dm tool. b. Alternatively, check/wait for the next NDK (sub-)release for a more current q2dm version.
Hope this helps!

Categories

Resources